]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/safe_numerics/example/example18.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / safe_numerics / example / example18.cpp
1 #include <boost/safe_numerics/safe_integer.hpp>
2 #include <boost/safe_numerics/safe_integer_literal.hpp>
3
4 using namespace boost::safe_numerics;
5
6 int f(int i){
7 return i;
8 }
9
10 template<intmax_t N>
11 using safe_literal = safe_signed_literal<N, native, loose_trap_policy>;
12
13 int main(){
14 const long x = 97;
15 f(x); // OK - implicit conversion to int
16 const safe_literal<97> y;
17 f(y); // OK - y is a type with min/max = 97;
18 return 0;
19 }