tmp/tmp8c8sd2iv/{from.md → to.md}
RENAMED
|
@@ -1,33 +1,34 @@
|
|
| 1 |
#### `valarray` element access <a id="valarray.access">[[valarray.access]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
const T& operator[](size_t) const;
|
| 5 |
-
T& operator[](size_t);
|
| 6 |
```
|
| 7 |
|
| 8 |
-
|
| 9 |
-
of the array.
|
| 10 |
|
| 11 |
-
|
| 12 |
-
non-constant `valarray<T> a`, any `T q`, and for any `size_t i` such
|
| 13 |
-
that the value of `i` is less than the length of `a`.
|
| 14 |
|
| 15 |
-
The expression `
|
| 16 |
-
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
The reference returned by the subscript operator for an array shall be
|
| 26 |
valid until the member function
|
| 27 |
`resize(size_t, T)` ([[valarray.members]]) is called for that array or
|
| 28 |
until the lifetime of that array ends, whichever happens first.
|
| 29 |
|
| 30 |
-
If the subscript operator is invoked with a `size_t` argument whose
|
| 31 |
-
value is not less than the length of the array, the behavior is
|
| 32 |
-
undefined.
|
| 33 |
-
|
|
|
|
| 1 |
#### `valarray` element access <a id="valarray.access">[[valarray.access]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
const T& operator[](size_t n) const;
|
| 5 |
+
T& operator[](size_t n);
|
| 6 |
```
|
| 7 |
|
| 8 |
+
*Requires:* `n < size()`.
|
|
|
|
| 9 |
|
| 10 |
+
*Returns:* A reference to the corresponding element of the array.
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
[*Note 1*: The expression `(a[i] = q, a[i]) == q` evaluates to `true`
|
| 13 |
+
for any non-constant `valarray<T> a`, any `T q`, and for any `size_t i`
|
| 14 |
+
such that the value of `i` is less than the length of
|
| 15 |
+
`a`. — *end note*]
|
| 16 |
|
| 17 |
+
*Remarks:* The expression `&a[i+j] == &a[i] + j` evaluates to `true` for
|
| 18 |
+
all `size_t i` and `size_t j` such that `i+j < a.size()`.
|
| 19 |
+
|
| 20 |
+
The expression `&a[i] != &b[j]` evaluates to `true` for any two arrays
|
| 21 |
+
`a` and `b` and for any `size_t i` and `size_t j` such that
|
| 22 |
+
`i < a.size()` and `j < b.size()`.
|
| 23 |
+
|
| 24 |
+
[*Note 2*: This property indicates an absence of aliasing and may be
|
| 25 |
+
used to advantage by optimizing compilers. Compilers may take advantage
|
| 26 |
+
of inlining, constant propagation, loop fusion, tracking of pointers
|
| 27 |
+
obtained from `operator new`, and other techniques to generate efficient
|
| 28 |
+
`valarray`s. — *end note*]
|
| 29 |
|
| 30 |
The reference returned by the subscript operator for an array shall be
|
| 31 |
valid until the member function
|
| 32 |
`resize(size_t, T)` ([[valarray.members]]) is called for that array or
|
| 33 |
until the lifetime of that array ends, whichever happens first.
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|