diff --git a/lexical_cast.htm b/lexical_cast.htm index 2a08541..c9d37be 100644 --- a/lexical_cast.htm +++ b/lexical_cast.htm @@ -81,7 +81,7 @@ conversions, such as where precision or formatting need tighter control than is offered by the default behavior of lexical_cast, the conventional stringstream approach is recommended. Where the conversions are - numeric to numeric, numeric_cast + numeric to numeric, numeric_cast may offer more reasonable behavior than lexical_cast.

For a good discussion of the options and issues involved in string-based @@ -202,9 +202,9 @@ public: Lexical conversion to these types is simply reading a byte from source but since the source has more than one byte, the exception is thrown.

Please use other integer types such as int or short int. If bounds checking - is important, you can also call numeric_cast: + is important, you can also call numeric_cast: -

numeric_cast<int8_t>(lexical_cast<int>("127"));
+
numeric_cast<int8_t>(lexical_cast<int>("127"));

Q: What does lexical_cast<std::string> of an int8_t or uint8_t not do what I expect?
A: As above, note that int8_t and uint8_t are actually chars and are formatted as such. To avoid this, cast to an integer type first: