![]() |
Home | Libraries | People | FAQ | More |
This type holds a integer in the range [MIN, MAX]. It will throw a
std::out_of_range exception for any operation which would
result in assigning an integer value outside of this range.
| Parameter | Requirements | Description |
|---|---|---|
MIN |
must be a positive integer literal | The minimum integer value that this type may hold |
MAX |
must be a positive integer literal | The maximum integer value that this type may hold |
|
MIN < MAX |
#include <safe/numeric/safe_range.hpp>
void f(){
boost::numeric::safe_unsigned_range<7, 24> i;
i = 0; // throws out_of_range exception
i = 9; // ok
i *= 9; // throws out_of_range exception
i = -1; // throws out_of_range exception
}