]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/safe_numerics/example/example81.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / safe_numerics / example / example81.cpp
CommitLineData
20effc67
TL
1// Copyright (c) 2018 Robert Ramey
2//
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)
6
92f5a8d4
TL
7#include <iostream>
8
9#include <boost/safe_numerics/safe_integer.hpp>
10#include <boost/safe_numerics/exception_policies.hpp> // include exception policies
11
12using safe_t = boost::safe_numerics::safe<
13 int,
14 boost::safe_numerics::native,
15 boost::safe_numerics::loose_trap_policy // note use of "loose_trap_exception" policy!
16>;
17
f67539c2 18int main(){
92f5a8d4
TL
19 std::cout << "example 81:\n";
20 safe_t x(INT_MAX);
21 safe_t y(2);
22 safe_t z = x + y; // will fail to compile !
23 return 0;
24}