
10 Mar
2005
10 Mar
'05
2:29 p.m.
"Peter Dimov" <pdimov@mmltd.net> 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 << x.data; }
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 www.boost-consulting.com