1 /** 2 Copyright: Copyright Thomas Stuart Bockman 2015 3 License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. 4 Authors: Thomas Stuart Bockman 5 */ 6 7 module checkedint.noex; 8 import checkedint.internal; 9 public import checkedint.flags; 10 11 import future.traits; 12 13 public import checkedint : 14 isSafeInt, 15 isSmartInt, 16 isCheckedInt, 17 hasBitOps, 18 isThrowingCInt, 19 BasicScalar; 20 21 @safe /+pragma(inline, true)+/ { 22 T to(T, bool throws, S)(const S value) 23 if(isScalarType!(BasicScalar!T) && isScalarType!(BasicScalar!S)) 24 { 25 const T ret = toImpl!(BasicScalar!T, throws)(value.bscal); 26 27 return ret; 28 } 29 T to(T, S)(S value) { 30 static if(isScalarType!(BasicScalar!T) && isScalarType!(BasicScalar!S)) 31 return to!(T, false, S)(value); 32 else { 33 import std.conv : stdTo = to; 34 return stdTo!T(value); 35 } 36 } 37 } 38 public import checkedint : 39 bscal, 40 bits, 41 idx; 42 43 public import safeOp = checkedint.noex.safeop; 44 public import smartOp = checkedint.noex.smartop; 45 46 template SafeInt(N, bool bitOps = true, bool throws = false) 47 { 48 import checkedint : Impl = SafeInt; 49 alias SafeInt = Impl!(N, bitOps, throws); 50 } 51 52 template SmartInt(N, bool bitOps = true, bool throws = false) 53 { 54 import checkedint : Impl = SmartInt; 55 alias SmartInt = Impl!(N, bitOps, throws); 56 }