Examples of ADL applications:
1. youyuan name insertion:
The membership function declaration in the class can be the first declaration of the membership function. See
The following example:
Template <typename T>
Class C {
...
Friend void F ();
Friend void F (C <t> const &);
};
Void G (c <int> * P)
{
F (); // Error
F (* P); // OK
}
Generally, the object meta declaration is invisible in the peripheral (class) scope.
If the class in which the youyuan function is located belongs to the dataset of the ADL Association class
The peripheral class can be found in the membership statement.
2. Plug-In Class Name
If the name of the class is inserted in the scope of the class, the name is
The name of the plug-in class. It can be seen as an unrestricted name in the scope of this class.
It is also an accessible name.
For example:
# Include <iostream>
Int C;
Class C {
PRIVATE:
Int I [2];
Public:
Static int F ()
{
Return sizeof (C );
}
};
The class template can also have the plug-in class name, which can be followed by the Template
If the real parameters are not followed by the template parameters, they represent parameters.
Class that represents real parameters, for example:
Template <template <typename T> class tt> Class X
{};
Template <typename T> Class C
{
C * A; // correct, equivalent to C <t> *;
C <void> B; // correct
X <C> C; // Error
X <: C> D; // Error
X <: C> E; // OK
}