safe_numerics/example/example16.cpp
Robert Ramey 58db776217 ixed issue related to lack of constexpr in exception with an “inline”
miscellaneous improvements in documentation
improved CMake implementation
2019-05-03 14:03:51 -07:00

16 lines
328 B
C++

#include <boost/safe_numerics/safe_integer.hpp>
using namespace boost::safe_numerics;
int f(int i){
return i;
}
using safe_t = safe<long>;
int main(){
const long x = 97;
f(x); // OK - implicit conversion to int
const safe_t y = 97;
f(y); // Also OK - checked implicit conversion to int
return 0;
}