|
sanisizer
Sanitize sizes to avoid integer overflow
|
Bound the maximum possible value of an integer. More...
#include <Bounded.hpp>
Public Types | |
| typedef Integer_ | Integer |
Public Member Functions | |
| constexpr | Bounded (Integer_ x) |
Public Attributes | |
| Integer_ | value |
Static Public Attributes | |
| static constexpr Integer_ | max = max_ |
Bound the maximum possible value of an integer.
| Integer_ | Type of the integer. |
| max_ | Maximum value of the integer, known at compile time. This should be non-negative. |
Specifies that an integer has a maximum upper bound of max_, known at compile-time. The upper bound may be less than the maxium value of Integer_, which enables some optimizations in functions like sum() and product(). For example, we could attest that a std::size_t has a upper limit of max_ = 2^31 - 1.
| Integer_ sanisizer::Bounded< Integer_, max_ >::Integer |
Type of the integer.
|
inlineconstexpr |
| x | Value of the integer. This should be no greater than max_. |
|
staticconstexpr |
Maximum value of the integer, known at compile time. This will be non-negative.
| Integer_ sanisizer::Bounded< Integer_, max_ >::value |
Value of the integer.