Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2000-01-24 14:03:50

From: <scleary_at_[hidden]>
> IMO, the best resolution is a change to the Standard, allowing overloading
> of functions in namespace std as long as the same semantics were
> This would allow us to always use explicit qualification. Has this been
> presented as an issue to the working group yet?

A problem with overloading functions in std is that it makes it harder to
prevent newer versions of the Standard from breaking old code.

For example, suppose the standard declares:

namespace std {
    struct A {A(int);};
    struct B {};
    void f(B);

And someone declares the following class and overload:

struct C {C(int);};
namespace std {
    void f(C);

And a user writes a program like this:

int main() {

It works fine, until the next version of the standard adds:

namespace std {
    void f(A);

And now the user program's call is ambiguous.

I agree that it would be nice to allow overloading of functions in namespace
std. However, in submitting a DR, it would be prudent to look at this and
other, if any, pitfalls, and propose restrictions on overloading and/or std
library design to avoid future problems.

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