tmp/tmp3edecjna/{from.md → to.md}
RENAMED
|
@@ -5,13 +5,13 @@ When a template is instantiated, the names of its friends are treated as
|
|
| 5 |
if the specialization had been explicitly declared at its point of
|
| 6 |
instantiation.
|
| 7 |
|
| 8 |
As with non-template classes, the names of namespace-scope friend
|
| 9 |
functions of a class template specialization are not visible during an
|
| 10 |
-
ordinary lookup unless explicitly declared at namespace scope
|
| 11 |
-
[[class.friend]]
|
| 12 |
-
|
| 13 |
|
| 14 |
[*Example 1*:
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
template<typename T> struct number {
|
|
@@ -21,11 +21,11 @@ template<typename T> struct number {
|
|
| 21 |
|
| 22 |
void g() {
|
| 23 |
number<double> a(3), b(4);
|
| 24 |
a = gcd(a,b); // finds gcd because number<double> is an associated class,
|
| 25 |
// making gcd visible in its namespace (global scope)
|
| 26 |
-
b = gcd(3,4); //
|
| 27 |
}
|
| 28 |
```
|
| 29 |
|
| 30 |
— *end example*]
|
| 31 |
|
|
|
|
| 5 |
if the specialization had been explicitly declared at its point of
|
| 6 |
instantiation.
|
| 7 |
|
| 8 |
As with non-template classes, the names of namespace-scope friend
|
| 9 |
functions of a class template specialization are not visible during an
|
| 10 |
+
ordinary lookup unless explicitly declared at namespace scope
|
| 11 |
+
[[class.friend]]. Such names may be found under the rules for associated
|
| 12 |
+
classes [[basic.lookup.argdep]].[^11]
|
| 13 |
|
| 14 |
[*Example 1*:
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
template<typename T> struct number {
|
|
|
|
| 21 |
|
| 22 |
void g() {
|
| 23 |
number<double> a(3), b(4);
|
| 24 |
a = gcd(a,b); // finds gcd because number<double> is an associated class,
|
| 25 |
// making gcd visible in its namespace (global scope)
|
| 26 |
+
b = gcd(3,4); // error: gcd is not visible
|
| 27 |
}
|
| 28 |
```
|
| 29 |
|
| 30 |
— *end example*]
|
| 31 |
|