From 39329bc5b99a8c36d3c7bbb0c7ad7c207ffea4af Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 10 Oct 2008 09:29:21 +0000 Subject: [PATCH] Merge quickbook workaround and fix some links. Merged revisions 48987,49230-49231 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r48987 | danieljames | 2008-09-28 13:21:39 +0100 (Sun, 28 Sep 2008) | 1 line Clean up some link errors. ........ r49230 | danieljames | 2008-10-09 23:13:48 +0100 (Thu, 09 Oct 2008) | 1 line position_iterator is meant to be a forward iterator, so avoid using operator+ with it. ........ r49231 | danieljames | 2008-10-09 23:14:14 +0100 (Thu, 09 Oct 2008) | 4 lines Work around the problems with window newlines in position_iterator. (I'm about to fix them, but this will get quickbook working immediately). Fixes #2155 ........ [SVN r49242] --- lexical_cast.htm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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: