blob: c9869c15d326c2f5687e385e367c344da45c0d45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright (c) 2018 Robert Ramey
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/integer.hpp>
#include <boost/safe_numerics/utility.hpp>
// include headers to support safe integers
#include <boost/safe_numerics/cpp.hpp>
using promotion_policy = boost::safe_numerics::cpp<
8, // char 8 bits
16, // short 16 bits
16, // int 16 bits
16, // long 32 bits
32 // long long 32 bits
>;
template<typename R, typename T, typename U>
struct test {
using ResultType = promotion_policy::result_type<T,U>;
//boost::safe_numerics::utility::print_type<ResultType> pt;
static_assert(
std::is_same<R, ResultType>::value,
"is_same<R, ResultType>"
);
};
test<std::uint16_t, std::uint8_t, std::uint8_t> t1;
int main(){
return 0;
}
|