Daniel Frey <[EMAIL PROTECTED]> writes:

> Daniel Spangenberg wrote:
>> No, I absolutely do understand, that  X<T> in the operators library defines
>> operators which take T as an argument. I hope, that my explanation meant that
>> (my english is bad, I know). But I think, that the standard does forbid the
>> visibiliy
>> of the operators injected by less_than_comparable<myclass> for myclass
>> because myclass is not the associated with less_than_comparable<**>. Now the
>> operators injected by less_than_comparable<myclass> take myclass as
>> arguments (those with arguments, I mean) and should noot be visible for
>> myclass.
>
> 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. ]

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to