1 #include <iostream> 2 3 #include <boost/safe_numerics/safe_integer.hpp> 4 #include <boost/safe_numerics/exception_policies.hpp> // include exception policies 5 6 using safe_t = boost::safe_numerics::safe< 7 int, 8 boost::safe_numerics::native, 9 boost::safe_numerics::loose_trap_policy // note use of "loose_trap_exception" policy! 10 >; 11 main()12int main(){ 13 std::cout << "example 81:\n"; 14 safe_t x(INT_MAX); 15 safe_t y(2); 16 safe_t z = x + y; // will fail to compile ! 17 return 0; 18 } 19