1 /**
2 Aliases for the $(LINK2 ./package.html, `checkedint`) module using `IntFlagPolicy.sticky`.
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.sticky;
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.sticky);
23 
24 static import checkedint;
25 
26 alias SmartInt(N, Flag!"bitOps" bitOps = Yes.bitOps) = checkedint.SmartInt!(N, IFP.sticky, bitOps);
27 SmartInt!(N, bitOps) smartInt(Flag!"bitOps" bitOps = Yes.bitOps, N)(N num) nothrow @nogc
28     if (isIntegral!N || isCheckedInt!N)
29 {
30     return typeof(return)(num.bscal);
31 }
32 alias smartOp = checkedint.smartOp!(IFP.sticky);
33 
34 alias DebugInt(N, Flag!"bitOps" bitOps = Yes.bitOps) = checkedint.DebugInt!(N, IFP.sticky, bitOps);
35 
36 alias SafeInt(N, Flag!"bitOps" bitOps = Yes.bitOps) = checkedint.SafeInt!(N, IFP.sticky, bitOps);
37 SafeInt!(N, bitOps) safeInt(Flag!"bitOps" bitOps = Yes.bitOps, N)(N num) nothrow @nogc
38     if (isIntegral!N || isCheckedInt!N)
39 {
40     return typeof(return)(num.bscal);
41 }
42 alias safeOp = checkedint.safeOp!(IFP.sticky);
43 
44 alias to(T) = checkedint.to!(T, IFP.sticky);
45 
46 Select!(isSigned!(BasicScalar!N), ptrdiff_t, size_t) idx(N)(const N num) nothrow @nogc
47     if (isScalarType!N || isCheckedInt!N)
48 {
49     return checkedint.to!(typeof(return), IFP.sticky)(num.bscal);
50 }
51 
52 public import checkedint :
53     bscal,
54     bits,
55     isSafeInt,
56     isSmartInt,
57     isCheckedInt,
58     hasBitOps,
59     intFlagPolicyOf,
60     BasicScalar;