From Jason Turner

[temp.mem.func]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4ees3h6n/{from.md → to.md} +12 -3
tmp/tmp4ees3h6n/{from.md → to.md} RENAMED
@@ -1,10 +1,12 @@
1
  #### Member functions of class templates <a id="temp.mem.func">[[temp.mem.func]]</a>
2
 
3
  A member function of a class template may be defined outside of the
4
  class template definition in which it is declared.
5
 
 
 
6
  ``` cpp
7
  template<class T> class Array {
8
  T* v;
9
  int sz;
10
  public:
@@ -22,19 +24,26 @@ template<class T> T& Array<T>::operator[](int i) {
22
  if (i<0 || sz<=i) error("Array: range error");
23
  return v[i];
24
  }
25
  ```
26
 
 
 
27
  The *template-argument*s for a member function of a class template are
28
  determined by the *template-argument*s of the type of the object for
29
- which the member function is called. the *template-argument* for
30
- `Array<T> :: operator [] ()` will be determined by the `Array` to which
31
- the subscripting operation is applied.
 
 
 
32
 
33
  ``` cpp
34
  Array<int> v1(20);
35
  Array<dcomplex> v2(30);
36
 
37
  v1[3] = 7; // Array<int>::operator[]()
38
  v2[3] = dcomplex(7,8); // Array<dcomplex>::operator[]()
39
  ```
40
 
 
 
 
1
  #### Member functions of class templates <a id="temp.mem.func">[[temp.mem.func]]</a>
2
 
3
  A member function of a class template may be defined outside of the
4
  class template definition in which it is declared.
5
 
6
+ [*Example 1*:
7
+
8
  ``` cpp
9
  template<class T> class Array {
10
  T* v;
11
  int sz;
12
  public:
 
24
  if (i<0 || sz<=i) error("Array: range error");
25
  return v[i];
26
  }
27
  ```
28
 
29
+ — *end example*]
30
+
31
  The *template-argument*s for a member function of a class template are
32
  determined by the *template-argument*s of the type of the object for
33
+ which the member function is called.
34
+
35
+ [*Example 2*:
36
+
37
+ The *template-argument* for `Array<T>::operator[]()` will be determined
38
+ by the `Array` to which the subscripting operation is applied.
39
 
40
  ``` cpp
41
  Array<int> v1(20);
42
  Array<dcomplex> v2(30);
43
 
44
  v1[3] = 7; // Array<int>::operator[]()
45
  v2[3] = dcomplex(7,8); // Array<dcomplex>::operator[]()
46
  ```
47
 
48
+ — *end example*]
49
+