summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/safe_numerics/test/test_cpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/safe_numerics/test/test_cpp.cpp')
-rw-r--r--src/boost/libs/safe_numerics/test/test_cpp.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/boost/libs/safe_numerics/test/test_cpp.cpp b/src/boost/libs/safe_numerics/test/test_cpp.cpp
new file mode 100644
index 00000000..c9869c15
--- /dev/null
+++ b/src/boost/libs/safe_numerics/test/test_cpp.cpp
@@ -0,0 +1,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;
+}
+