Boost logo

Boost :

Subject: Re: [boost] [explore] Extending namespace std
From: Jeffrey Faust (jeff_at_[hidden])
Date: 2009-12-15 19:41:54

Hello again.
I previously presented an argument of why our best option for container
streaming is to extend namespace std. I was surprised by the
dearth of responses, but I understand that we're all busy and I
admit was a bit wordy. Here is my argument again with, heavily snipped.

I think this is the most important issue in making this a boost library.
Thanks for reading.

Jeffrey Faust wrote:
> In my opinion the ideal interface is the most natural,
> simplest, and the most familiar to C++ developers: 'cout << c;' where
> c is a container of type C.
> The only way I know how to make 'cout << c;' work for all cases is to
> put operator<<(C) in the same namespace as C. For example,
> variant<C, ...> will not stream if C is in std and operator<<(C) is
> not.
> In regards to extending namespace std, I understand what the standard
> says and I think I understand the reasons behind it. One could add
> something to namespace std that conflicts with an existing item,
> changing the behavior. This is undefined behavior, and the
> standard is right in restricting it. I don't believe this problem
> exists for this library in how we plan to extend std.
> If we know that on all supported compilers that extending namespace
> std in this way behaves correctly, what is the concrete problem of
> doing so?

-- Jeff Faust

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