]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/safe_numerics/example/example81.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / safe_numerics / example / example81.cpp
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
12 int main(int argc, const char * argv[]){
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 }