...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
Return the stored number cast to an arithmetic type.
template< class T> T to_number() const;
This function attempts to return the stored value converted to the arithmetic
T which may not
Tis an integral type and the stored value is a number which can be losslessly converted, the conversion is performed without error and the converted number is returned.
Tis an integral type and the stored value is a number which cannot be losslessly converted, then the operation fails with an error.
Tis a floating point type and the stored value is a number, the conversion is performed without error. The converted number is returned, with a possible loss of precision.
false, then the operation fails with an error.
std::is_arithmetic< T >::value && ! std::is_same< T, bool >::value
The converted number.