Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-07-22 09:18:47


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.

Regards, Daniel

PS: I don't think english is our problem, but if you feel more
comfortable with german you can mail me directly if you like.

-- 
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: daniel.frey_at_[hidden], web: http://www.aixigo.de

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