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