...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
sizeof(double) < sizeof(long double)
).
std::numeric_limits
,
the current version now chooses a precision to match.
lexical_cast
now supports conversions from wchar_t
,
wchar_t *
,
and std::wstring
and to wchar_t
and std::wstring
.
lexical_cast
assumed that the conventional stream extractor operators were sufficient
for reading values. However, string I/O is asymmetric, with the result
that spaces play the role of I/O separators rather than string content.
The current version fixes this error for std::string
and, where supported, std::wstring
:
lexical_cast<std::string>("Hello, World")
succeeds instead of failing with a bad_lexical_cast
exception.
lexical_cast
allowed unsafe and meaningless conversions to pointers. The current
version now throws a bad_lexical_cast
for conversions to pointers: lexical_cast<char
*>("Goodbye,
World")
now
throws an exception instead of causing undefined behavior.