Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-03-10 09:29:47

"Peter Dimov" <pdimov_at_[hidden]> writes:

> When a type's operator<< is "broken", you can't fix it from the outside.

I wasn't trying to fix it from the outside; I was trying to give
optional a way of unambiguously indicating emptiness.

> struct X
> {
> std::string data;
> };
> ostream& operator<< ( ostream& os, X const & x )
> {
> return os <<;
> }
> It is not reasonable to expect all types that rely on string::<< to
> fix it to match your (arbitrary, I might add) convention.

So what? I don't see what bearing it has.

I could buy into the argument that optional will always print
ambiguously anyway, since optional<char const*>("123") and
optional<int>(123) will print the same text.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at