Boost logo

Boost :

Subject: Re: [boost] [explore] Extending namespace std
From: Maurizio Vitale (maurizio.vitale_at_[hidden])
Date: 2009-12-16 09:54:19

>>>>> "Robert" == Robert Ramey <ramey_at_[hidden]> writes:

    Robert> Jeffrey Faust wrote:
>>> 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.

    Robert> How can anyone possibly know that? That is, how could two
    Robert> different developers who didn't know each other possibly
    Robert> know that they weren't going to conflict?

    Robert> Of course if you wanted to officially extended the namespace
    Robert> that would be a different thing entirely.

It is more than conflict: the C++ standard fully defines the content of
std and compilers are not required to implement it as they implement
other namespaces, as long as they behave as if such a namespace was

In particular, turning the entire namespace std { } block into a
compiler-time nop is entirely ok.

Not that this happens with any of the presently available compilers, but
it could.

On the other hand, if we can get some nice functionality that cannot be
achieved otherwise, I wouldn't have too many problems with being
pragmatic and extending std.

If it becomes very useful, it might be accepted into the standard or
additional mechanisms not relying on extending std may be provided.

Best regards,


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