test_cpp.cpp 924 B

123456789101112131415161718192021222324252627282930313233343536
  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. #include <boost/integer.hpp>
  7. #include <boost/safe_numerics/utility.hpp>
  8. // include headers to support safe integers
  9. #include <boost/safe_numerics/cpp.hpp>
  10. using promotion_policy = boost::safe_numerics::cpp<
  11. 8, // char 8 bits
  12. 16, // short 16 bits
  13. 16, // int 16 bits
  14. 16, // long 32 bits
  15. 32 // long long 32 bits
  16. >;
  17. template<typename R, typename T, typename U>
  18. struct test {
  19. using ResultType = promotion_policy::result_type<T,U>;
  20. //boost::safe_numerics::utility::print_type<ResultType> pt;
  21. static_assert(
  22. std::is_same<R, ResultType>::value,
  23. "is_same<R, ResultType>"
  24. );
  25. };
  26. test<std::uint16_t, std::uint8_t, std::uint8_t> t1;
  27. int main(){
  28. return 0;
  29. }