[Home]LexicalCast

BOOST WIKI | RecentChanges | Preferences | Page List | Links List

/Version2 Proposal
http://www.boost.org/libs/conversion/lexical_cast.htm
A nice addition would be a to_string which would not stop parsing when hitting white space of a string. Take a look at the following discussion threads on this topic.

http://lists.boost.org/MailArchives/boost/msg23687.php

http://lists.boost.org/MailArchives/boost/msg23923.php

http://lists.boost.org/MailArchives/boost/msg24086.php


Personally I use this in my c++ wrapper around libxml2 for convenience of putting data types into my attributes or data of nodes.

Caveats:


I (People/Jeff Garland) have also used lexical cast for xml related conversions. A number of us have run across some edges with this library.

One issue with the library is the handling of doubles being truncated due to the default precision setting of the stream. This doesn't throw an exception, but doesn't give the right correct result either.

 std::string s(1.123456789);
 double d = lexical_cast<double>(s);  //oops truncated due to precision of std::stringstream

You can see this message for more discussion http://groups.yahoo.com/group/boost/message/15025


BOOST WIKI | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited September 23, 2008 6:49 am (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers