]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/safe_numerics/example/example17.cpp
1 // Copyright (c) 2018 Robert Ramey
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/safe_numerics/safe_integer.hpp>
8 #include <cstdint> // uint8_t
9 using namespace boost::safe_numerics
;
15 using safe_t
= safe
<long, native
, loose_trap_policy
>;
19 f(x
); // OK - implicit conversion to int can never fail
21 f(y
); // could overflow so trap at compile time