tmp/tmprnuw43g_/{from.md → to.md}
RENAMED
|
@@ -15,11 +15,11 @@ public:
|
|
| 15 |
T& elem(int i) { return v[i]; }
|
| 16 |
};
|
| 17 |
```
|
| 18 |
|
| 19 |
declares three member functions of a class template. The subscript
|
| 20 |
-
function
|
| 21 |
|
| 22 |
``` cpp
|
| 23 |
template<class T> T& Array<T>::operator[](int i) {
|
| 24 |
if (i<0 || sz<=i) error("Array: range error");
|
| 25 |
return v[i];
|
|
|
|
| 15 |
T& elem(int i) { return v[i]; }
|
| 16 |
};
|
| 17 |
```
|
| 18 |
|
| 19 |
declares three member functions of a class template. The subscript
|
| 20 |
+
function can be defined like this:
|
| 21 |
|
| 22 |
``` cpp
|
| 23 |
template<class T> T& Array<T>::operator[](int i) {
|
| 24 |
if (i<0 || sz<=i) error("Array: range error");
|
| 25 |
return v[i];
|