summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/safe_numerics/example/example16.cpp
blob: d678245262077bef240606cf116abf0ff57193a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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;
}