BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
#include <safe.hpp>
Public Member Functions | |
safe ()=default | |
template<typename V > | |
safe (V v) | |
template<typename V > | |
safe & | operator= (V v) |
template<typename... Dummy, typename X = T, std::enable_if_t< std::is_signed< X >::value, bool > = true> | |
safe | operator- () const |
template<typename... Dummy, typename X = T, std::enable_if_t< std::is_unsigned< X >::value, bool > = true> | |
safe | operator- () const |
safe & | operator+= (const safe &b) |
safe & | operator-= (const safe &b) |
safe & | operator*= (const safe &b) |
safe & | operator/= (const safe &b) |
safe & | operator%= (const safe &b) |
safe & | operator++ () |
safe | operator++ (int) |
safe & | operator-- () |
safe | operator-- (int) |
Static Public Member Functions | |
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 () |
Public Attributes | |
T | value = 0 |
Friends | |
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) |
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
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |