Another bug in boost.lexical_cast 1.30
lexical_cast.hpp line 145: bool operator<<(const Source &input) { return stream << input; } Convert basic_stringstream & to bool? -- /*******************/ ×ÔÓÉ£šliberty£©ÎÞ·ÇŸÍÊÇÕâÑùÒ»ÖÖ³Ðŵ£ºÃ¿žöÈËœ«»áµÃµœÒ»ÖÖ±£ÕÏ£¬±£ÕÏÎÒÃÇ¿ÉÒÔÓë ÈšÍþ¡¢¶àÊý¡¢Á÷Ë׌°ÓßÂÛµÄÓ°ÏìÏ࿹ºâ¡£ /*******************/
From: "Black Ice"
lexical_cast.hpp line 145: bool operator<<(const Source &input) { return stream << input; } Convert basic_stringstream & to bool?
Yes. :) basic_stringstream has a user-defined conversion to void *, which then converts to bool, giving the stream state. It has been suggested on the Boost list to change this to a more explicit test, though (also to remove a warning for this conversion), such as: bool operator<<(const Source &input) { return !(stream << input).fail(); } Regards, Terje
Thanks
--
/*******************/
×ÔÓÉ£šliberty£©ÎÞ·ÇŸÍÊÇÕâÑùÒ»ÖÖ³Ðŵ£ºÃ¿žöÈËœ«»áµÃµœÒ»ÖÖ±£ÕÏ£¬±£ÕÏÎÒÃÇ¿ÉÒÔÓë
ÈšÍþ¡¢¶àÊý¡¢Á÷Ë׌°ÓßÂÛµÄÓ°ÏìÏ࿹ºâ¡£
/*******************/
"Terje Sletteb?"
From: "Black Ice"
lexical_cast.hpp line 145: bool operator<<(const Source &input) { return stream << input; } Convert basic_stringstream & to bool?
Yes. :)
basic_stringstream has a user-defined conversion to void *, which then converts to bool, giving the stream state. It has been suggested on the Boost list to change this to a more explicit test, though (also to remove a warning for this conversion), such as:
bool operator<<(const Source &input) { return !(stream << input).fail(); }
Regards,
Terje
Info: http://www.boost.org Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
participants (2)
-
Black Ice
-
Terje Slettebø