Daniel Frey <[EMAIL PROTECTED]> writes:
They needn't be visible for myclass. They only need to be visible in the namespace where this happened. See 3.4.2/2:
"If T is a class type, its associated classes are the class itself and its direct and indirect base classes. Its associated namespaces are the namespaces in which its associated classes are defined."
The namespace is what is important here, not the class. The friend-operators declared by X<T> are injected to the namespace as given by 14.6.2/2:
"As with non-template classes, the names of namespace-scope friend functions of a class template special-ization are not visible during an ordinary lookup unless explicitly declared at namespace scope (11.4). Such names may be found under the rules for associated classes (3.4.2)."
note the "...namespace-scope friend functions...", which to me means that the operators are not injected to X<T>, but to the namespace where the explicit instantiation happened. As this should be the same namespace where T lives, anything should IMHO be legal C++. At least this is how I read the standard.
Maybe I'm missing something in what you say, but I think they are "visible for myclass", and the relevant text is in 3.4.2/2:
--- If T is a template-id, its associated namespaces and classes are the namespace in which the template is defined; for member templates, the member template's class; the namespaces and classes associated ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with the types of the template arguments provided for template type ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ parameters (excluding template template parameters); the namespaces in ^^^^^^^^^^ which any template template arguments are defined; and the classes in which any member templates used as template template arguments are defined. [Note: non- type template arguments do not contribute to the set of associated namespaces. ]
IIUC, the 'T' that the standard mentions is the 'myclass' in Daniel Spangenberg's example. The operators provided by X<T> should be found in T's namespace, so it works whether 'T' is a template-id or not. I thus thought that the problem was, if 14.6.5 does what we need when explicitly instantiating X<T>. But maybe I'm missing something.
Regards, Daniel
-- Daniel Frey
aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: [EMAIL PROTECTED], web: http://www.aixigo.de
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost