Boost logo

Boost Users :

From: Terje Slettebų (tslettebo_at_[hidden])
Date: 2003-03-28 21:08:15


>From: "Black Ice" <yg-boost-users_at_[hidden]>

> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net