1 /**
2 Aliases for the $(LINK2 ./package.html, `checkedint`) module using `IntFlagPolicy.throws`.
3 
4 Copyright: Copyright Thomas Stuart Bockman 2015
5 License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6 Authors: Thomas Stuart Bockman
7 **/
8 module checkedint.throws;
9 
10 import future.traits0, std.typecons;
11 
12 @safe: pragma(inline, true):
13 
14 static import checkedint.flags;
15 public import checkedint.flags :
16     IntFlagPolicy,
17     IntFlag,
18     IntFlags,
19     CheckedIntException;
20 private alias IFP = IntFlagPolicy;
21 
22 alias raise = checkedint.flags.raise!(IFP.throws);
23 
24 static import checkedint;
25 
26 alias SmartInt(N, Flag!"bitOps" bitOps = Yes.bitOps) = checkedint.SmartInt!(N, IFP.throws, bitOps);
27 SmartInt!(N, bitOps) smartInt(Flag!"bitOps" bitOps = Yes.bitOps, N)(N num) pure
28     if (isIntegral!N || isCheckedInt!N)
29 {
30     return typeof(return)(num.bscal);
31 }
32 alias smartOp = checkedint.smartOp!(IFP.throws);
33 
34 alias DebugInt(N, Flag!"bitOps" bitOps = Yes.bitOps) = checkedint.DebugInt!(N, IFP.throws, bitOps);
35 
36 alias SafeInt(N, Flag!"bitOps" bitOps = Yes.bitOps) = checkedint.SafeInt!(N, IFP.throws, bitOps);
37 SafeInt!(N, bitOps) safeInt(Flag!"bitOps" bitOps = Yes.bitOps, N)(N num) pure
38     if (isIntegral!N || isCheckedInt!N)
39 {
40     return typeof(return)(num.bscal);
41 }
42 alias safeOp = checkedint.safeOp!(IFP.throws);
43 
44 alias to(T) = checkedint.to!(T, IFP.throws);
45 
46 Select!(isSigned!(BasicScalar!N), ptrdiff_t, size_t) idx(N)(const N num) pure
47     if (isScalarType!N || isCheckedInt!N)
48 {
49     return checkedint.to!(typeof(return), IFP.throws)(num.bscal);
50 }
51 
52 public import checkedint :
53     bscal,
54     bits,
55     isSafeInt,
56     isSmartInt,
57     isCheckedInt,
58     hasBitOps,
59     intFlagPolicyOf,
60     BasicScalar;