mirror of
https://github.com/boostorg/safe_numerics.git
synced 2026-02-22 03:32:24 +00:00
19 lines
478 B
C++
19 lines
478 B
C++
#include <iostream>
|
|
|
|
#include "../include/safe_integer.hpp"
|
|
#include "../include/exception_policies.hpp" // include exception policies
|
|
|
|
using safe_t = boost::numeric::safe<
|
|
int,
|
|
boost::numeric::native,
|
|
boost::numeric::loose_trap_policy // note use of "loose_trap_exception" policy!
|
|
>;
|
|
|
|
int main(int argc, const char * argv[]){
|
|
std::cout << "example 81:\n";
|
|
safe_t x(INT_MAX);
|
|
safe_t y(2);
|
|
safe_t z = x + y; // will fail to compile !
|
|
return 0;
|
|
}
|