tmp/tmpb9k8nyd9/{from.md → to.md}
RENAMED
|
@@ -4,11 +4,11 @@
|
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
template <class T> class indirect_array {
|
| 8 |
public:
|
| 9 |
-
|
| 10 |
|
| 11 |
void operator= (const valarray<T>&) const;
|
| 12 |
void operator*= (const valarray<T>&) const;
|
| 13 |
void operator/= (const valarray<T>&) const;
|
| 14 |
void operator%= (const valarray<T>&) const;
|
|
@@ -54,21 +54,25 @@ values of the argument array elements to selected elements of the
|
|
| 54 |
`valarray<T>` object to which it refers.
|
| 55 |
|
| 56 |
If the `indirect_array` specifies an element in the `valarray<T>` object
|
| 57 |
to which it refers more than once, the behavior is undefined.
|
| 58 |
|
|
|
|
|
|
|
| 59 |
``` cpp
|
| 60 |
int addr[] = {2, 3, 1, 4, 4};
|
| 61 |
valarray<size_t> indirect(addr, 5);
|
| 62 |
valarray<double> a(0., 10), b(1., 5);
|
| 63 |
a[indirect] = b;
|
| 64 |
```
|
| 65 |
|
| 66 |
results in undefined behavior since element 4 is specified twice in the
|
| 67 |
indirection.
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
|
| 70 |
|
| 71 |
``` cpp
|
| 72 |
void operator*= (const valarray<T>&) const;
|
| 73 |
void operator/= (const valarray<T>&) const;
|
| 74 |
void operator%= (const valarray<T>&) const;
|
|
@@ -79,11 +83,11 @@ void operator&= (const valarray<T>&) const;
|
|
| 79 |
void operator|= (const valarray<T>&) const;
|
| 80 |
void operator<<=(const valarray<T>&) const;
|
| 81 |
void operator>>=(const valarray<T>&) const;
|
| 82 |
```
|
| 83 |
|
| 84 |
-
These
|
| 85 |
indicated operation to the elements of the argument array and selected
|
| 86 |
elements of the `valarray<T>` object to which the `indirect_array`
|
| 87 |
object refers.
|
| 88 |
|
| 89 |
If the `indirect_array` specifies an element in the `valarray<T>` object
|
|
|
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
template <class T> class indirect_array {
|
| 8 |
public:
|
| 9 |
+
using value_type = T;
|
| 10 |
|
| 11 |
void operator= (const valarray<T>&) const;
|
| 12 |
void operator*= (const valarray<T>&) const;
|
| 13 |
void operator/= (const valarray<T>&) const;
|
| 14 |
void operator%= (const valarray<T>&) const;
|
|
|
|
| 54 |
`valarray<T>` object to which it refers.
|
| 55 |
|
| 56 |
If the `indirect_array` specifies an element in the `valarray<T>` object
|
| 57 |
to which it refers more than once, the behavior is undefined.
|
| 58 |
|
| 59 |
+
[*Example 1*:
|
| 60 |
+
|
| 61 |
``` cpp
|
| 62 |
int addr[] = {2, 3, 1, 4, 4};
|
| 63 |
valarray<size_t> indirect(addr, 5);
|
| 64 |
valarray<double> a(0., 10), b(1., 5);
|
| 65 |
a[indirect] = b;
|
| 66 |
```
|
| 67 |
|
| 68 |
results in undefined behavior since element 4 is specified twice in the
|
| 69 |
indirection.
|
| 70 |
|
| 71 |
+
— *end example*]
|
| 72 |
+
|
| 73 |
+
#### `indirect_array` compound assignment <a id="indirect.array.comp.assign">[[indirect.array.comp.assign]]</a>
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
void operator*= (const valarray<T>&) const;
|
| 77 |
void operator/= (const valarray<T>&) const;
|
| 78 |
void operator%= (const valarray<T>&) const;
|
|
|
|
| 83 |
void operator|= (const valarray<T>&) const;
|
| 84 |
void operator<<=(const valarray<T>&) const;
|
| 85 |
void operator>>=(const valarray<T>&) const;
|
| 86 |
```
|
| 87 |
|
| 88 |
+
These compound assignments have reference semantics, applying the
|
| 89 |
indicated operation to the elements of the argument array and selected
|
| 90 |
elements of the `valarray<T>` object to which the `indirect_array`
|
| 91 |
object refers.
|
| 92 |
|
| 93 |
If the `indirect_array` specifies an element in the `valarray<T>` object
|