#include <boundednumber.h>
The template can be instantiated for any integral type smaller than or equal to type LargeInt.
An instance of this class or the Float class stores a single number, silently enforcing upper and lower bounds for construction, assignment, and copying from other types. Unlike the implicit aliasing of e.g. a char, the boundaries may be smaller than the maximum representable in that type (although for integers the default range is the full range available) and values outside the range can either be truncated (cropped) at the boundaries, or aliased (wrapped) into the valid range.
Definition at line 65 of file boundednumber.h.
Public Methods | |
Integer () | |
Default constructor. | |
Integer (value_type val) | |
Constructs using specified value. | |
Integer (const self &other) | |
Copy constructor. | |
template<class OT, LargeInt OMaxVal, LargeInt OMinVal, class OBoundary> | Integer (const Float< OT, OMaxVal, OMinVal, OBoundary > &other) |
Construct from a Bounded::Float. | |
void | operator= (const LargeInt &val) |
Set to a numeric value; assumes LargeInt is an encompassing type. | |
self & | operator *= (const LargeFloat m) |
Multiplicative scaling. | |
self | operator+ (const self &B) const |
Integer addition. | |
Magnitude | mag () const |
Returns the current numeric value as a fraction of the maximum. | |
value_type | raw () const |
Returns the current numeric value in the native units. | |
Static Public Attributes | |
const value_type | Min = MinVal |
Minimum legal value. | |
const value_type | Max = MaxVal |
Maximum legal value. |