|
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_signed< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_signed< V >::value, bool > = true> |
static T | check (V v) |
|
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_unsigned< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_unsigned< V >::value, bool > = true> |
static T | check (V v) |
|
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_unsigned< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_signed< V >::value, bool > = true> |
static T | check (V v) |
|
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_signed< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_unsigned< V >::value, bool > = true> |
static T | check (V v) |
|
static constexpr safe | min () |
|
static constexpr safe | max () |
|
|
safe | operator+ (const safe &a, const safe &b) |
|
safe | operator- (const safe &a, const safe &b) |
|
safe | operator* (const safe &a, const safe &b) |
|
template<typename... Dummy, typename X = T, std::enable_if_t< std::is_signed< X >::value, bool > = true> |
safe | operator/ (const safe &a, const safe &b) |
|
template<typename... Dummy, typename X = T, std::enable_if_t< std::is_unsigned< X >::value, bool > = true> |
safe | operator/ (const safe &a, const safe &b) |
|
template<typename... Dummy, typename X = T, std::enable_if_t< std::is_signed< X >::value, bool > = true> |
safe | operator% (const safe &a, const safe &b) |
|
template<typename... Dummy, typename X = T, std::enable_if_t< std::is_unsigned< X >::value, bool > = true> |
safe | operator% (const safe &a, const safe &b) |
|
bool | operator== (const safe &a, const safe &b) |
|
bool | operator== (const safe &a, T b) |
|
bool | operator== (T a, const safe &b) |
|
bool | operator< (const safe &a, const safe &b) |
|
bool | operator< (const safe &a, T b) |
|
bool | operator< (T a, const safe &b) |
|
bool | operator> (const safe &a, const safe &b) |
|
bool | operator> (const safe &a, T b) |
|
bool | operator> (T a, const safe &b) |
|
bool | operator!= (const safe &a, const safe &b) |
|
bool | operator!= (const safe &a, T b) |
|
bool | operator!= (T a, const safe &b) |
|
bool | operator<= (const safe &a, const safe &b) |
|
bool | operator<= (const safe &a, T b) |
|
bool | operator<= (T a, const safe &b) |
|
bool | operator>= (const safe &a, const safe &b) |
|
bool | operator>= (const safe &a, T b) |
|
bool | operator>= (T a, const safe &b) |
|
template<typename T>
struct fc::safe< T >
This type is designed to provide automatic checks for integer overflow and default initialization. It will throw an exception on overflow conditions.
It can only be used on built-in types.
Implemented using spec from: https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
Definition at line 26 of file safe.hpp.
template<typename T >
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_signed< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_signed< V >::value, bool > = true>
template<typename T >
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_unsigned< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_unsigned< V >::value, bool > = true>
template<typename T >
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_unsigned< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_signed< V >::value, bool > = true>
template<typename T >
template<typename V , typename... Dummy, typename X = T, std::enable_if_t< std::is_signed< X >::value, bool > = true, std::enable_if_t< std::is_integral< V >::value, bool > = true, std::enable_if_t< std::is_unsigned< V >::value, bool > = true>