Boost logo

Boost :

From: Rani (rani_sharoni_at_[hidden])
Date: 2002-10-26 12:08:33


Aleksey Gurtovoy writes:
> Here's a class template that keeps track of its instantiations:

> Seems well-formed to me, and works with Intel C++ 6.0 and one other
> compiler.

VC7.1/7/6 also compiled the code but Comead 4.3.0.1 (EDG based) rejected the
code. I suspect that Comeau's EDG, unlike the Intel's EDG, is correct
because you are actually injecting names into the namespace and C++ doesn't
allow that. I once tried to use the same technique to generate map from
types to integers in order to try and come up with compliant typeof and
discover the name injection problem.

According to 3.3.1/6:
friend declarations refer to functions or classes that are members of the
nearest enclosing namespace, but they *do not introduce new names* into that
namespace.

According to 14.6.5/2 comment 131:
Friend declarations *do not introduce new names* into any scope, either when
the template is declared or when it is instantiated.

I hope that I and EDG are wrong.

Rani


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk