Problem with ostream_iterator (fwd)

Philip Martin pm@corris.dircon.co.uk
Sat Apr 1 00:00:00 GMT 2000


Chan Shih-Ping Richard <cshihpin@dso.org.sg> writes:

> Philip Martin has clearly explained my faulty understanding

Oops, I did intended to send my earlier reply to the list and not just
to Richard.

> of namespace scoping below. To get
> testsuite/23_containers/multiset.cc to succeed with
> -fhonor-std just define operator<< for std::pair
> in a namespace std { ... } scope.

It may compile, link and run but I think it violates 17.4.3.1
[lib.reserved.names]:

"It is undefined for a C++ program to add declarations or definitions
within namespace std unless otherwise specified."

A program is allowed to add template specialisations (complete or
partial) to namespace std, but only if they depend on a user-defined
name of external linkage.

Philip


More information about the Libstdc++ mailing list