35namespace overflow_controlled_integer_accumulator_details
38template<
typename T,
typename Storage_Type >
40typename std::enable_if< std::is_signed<T>::value,
bool >::type
47template<
typename T,
typename Storage_Type >
49typename std::enable_if< !std::is_signed<T>::value,
bool >::type
58template<
typename T,
typename Ext >
67 std::numeric_limits<T>::max() );
73 static_assert( std::is_signed<T>::value,
74 "extremum_value<T, check_negative_extremum> is defined only "
75 "for signed numeric types" );
80 std::numeric_limits<T>::min() );
83 value == (
static_cast<storage_type>(std::numeric_limits<T>::max()) + 1u),
84 "The integer representation is expected to be two's complement" );
158 using namespace overflow_controlled_integer_accumulator_details;
168 is_greater_than_maximum<T>( updated_value, extremum_value::value ) )
Helper class for accumulating integer value during parsing it from string (with check for overflow).
storage_type m_current
The current value of the accumulator.
void next_digit(T digit) noexcept
Try to add another digit to the accumulator.
typename extremum_value::storage_type storage_type
Type to be used for holding intermediate value.
T value() const noexcept
Get the current accumulator value.
bool overflow_detected() const noexcept
Is overflow detected during previous call to next_digit?
bool m_overflow_detected
Overflow detection flag.
Detection of compiler version and absence of various features.
#define RESTINIO_NODISCARD
RESTINIO_NODISCARD auto digit() noexcept
A factory function to create a clause that expects a decimal digit, extracts it and then skips it.
constexpr underlying_uint_t maximum
The maximal allowed value for a qvalue.
RESTINIO_NODISCARD std::enable_if< std::is_signed< T >::value, bool >::type is_greater_than_maximum(Storage_Type v, Storage_Type maximum)
std::make_unsigned_t< T > storage_type
std::make_unsigned_t< T > storage_type