Reputation: 1093
A point from ISO C++ DRAFT n3290 :Argument dependant Name Lookup : section 3.4.2, para 2,
For each argument type T in the function call, there is a set of zero or more associated namespaces and a set of zero or more associated classes to be considered. The sets of namespaces and classes is determined entirely by the types of the function arguments (and the namespace of any template template argument).Typedef names and using-declaration s used to specify the types do not contribute to this set. The sets of namespaces and classes are determined in the following way:
— If T is a fundamental type, its associated sets of namespace and classes are both empty.
— If T is a class type (including unions), its associated classes are: the class itself; the class of which it is a member, if any; and its direct and indirect base classes. Its associated namespaces are the namespaces of which its associated classes are members.
Furthermore, if T is a class template specialization, its associated namespaces and classes also include: the namespaces and classes associated with the types of the template arguments provided for template type parameters (excluding template template parameters); the namespaces of which any template template arguments are members; and the classes of which any member templates used as template template arguments are
members.[ Note: Non-type template arguments do not contribute to the set of a associated namespaces. — end note ]
Can any one please expalin this in terms of an example ...please
here in the above statement "sets of namespaces and classes are both empty" ..how this is possible ?
And in the 2nd point he said the as further more ... please can any one explain this ?
Upvotes: 1
Views: 311
Reputation: 92211
The fundamental types, like int
and char
, are not defined in any namespace or class. That's why their list of associations will be empty.
If the function parameters are types created from a template, not only the namespace of this template is considered, but also the namespaces of its template parameters. For example if you have a std::vector<foo::bar>
as a parameter, the set of namespaces will include both std
and foo
.
Upvotes: 6