]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/safe_numerics/example/example82.cpp
3 #include <boost/safe_numerics/safe_integer.hpp>
4 #include <boost/safe_numerics/exception_policies.hpp>
5 #include <boost/safe_numerics/automatic.hpp>
6 #include "safe_format.hpp" // prints out range and value of any type
8 using safe_t
= boost::safe_numerics::safe
<
10 boost::safe_numerics::automatic
, // note use of "automatic" policy!!!
11 boost::safe_numerics::loose_trap_policy
14 int main(int, const char *[]){
15 std::cout
<< "example 82:\n";
18 std::cout
<< "x = " << safe_format(x
) << std::endl
;
19 std::cout
<< "y = " << safe_format(y
) << std::endl
;
20 std::cout
<< "x + y = " << safe_format(x
+ y
) << std::endl
;