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
7#include <boost/safe_numerics/safe_integer.hpp>
8using namespace boost::safe_numerics;
9
10int f(int i){
11 return i;
12}
13
14using safe_t = safe<long>;
15
16int main(){
17 const long x = 97;
18 f(i: x); // OK - implicit conversion to int
19 const safe_t y = 97;
20 f(i: y); // Also OK - checked implicit conversion to int
21 return 0;
22}

source code of boost/libs/safe_numerics/example/example16.cpp