tmp/tmpk9abigjx/{from.md → to.md}
RENAMED
|
@@ -19,50 +19,76 @@ size_t size() const;
|
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
T sum() const;
|
| 22 |
```
|
| 23 |
|
| 24 |
-
This function may only be instantiated for a
|
| 25 |
-
`operator+=` can be applied.
|
| 26 |
-
elements of the array.
|
| 27 |
|
| 28 |
-
|
| 29 |
-
length 1,
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
unspecified order.
|
| 33 |
|
| 34 |
``` cpp
|
| 35 |
T min() const;
|
| 36 |
```
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
``` cpp
|
| 44 |
T max() const;
|
| 45 |
```
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
-
valarray
|
| 54 |
```
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
``` cpp
|
| 57 |
-
valarray
|
| 58 |
```
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
``` cpp
|
| 61 |
-
valarray
|
| 62 |
-
valarray
|
| 63 |
```
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
``` cpp
|
| 66 |
void resize(size_t sz, T c = T());
|
| 67 |
```
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
T sum() const;
|
| 22 |
```
|
| 23 |
|
| 24 |
+
*Requires:* `size() > 0`. This function may only be instantiated for a
|
| 25 |
+
type `T` to which `operator+=` can be applied.
|
|
|
|
| 26 |
|
| 27 |
+
*Returns:* The sum of all the elements of the array. If the array has
|
| 28 |
+
length 1, returns the value of element 0. Otherwise, the returned value
|
| 29 |
+
is calculated by applying `operator+=` to a copy of an element of the
|
| 30 |
+
array and all other elements of the array in an unspecified order.
|
|
|
|
| 31 |
|
| 32 |
``` cpp
|
| 33 |
T min() const;
|
| 34 |
```
|
| 35 |
|
| 36 |
+
*Requires:* `size() > 0`
|
| 37 |
+
|
| 38 |
+
*Returns:* The minimum value contained in `*this`. For an array of
|
| 39 |
+
length 1, the value of element 0 is returned. For all other array
|
| 40 |
+
lengths, the determination is made using `operator<`.
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
T max() const;
|
| 44 |
```
|
| 45 |
|
| 46 |
+
*Requires:* `size() > 0`.
|
| 47 |
+
|
| 48 |
+
*Returns:* The maximum value contained in `*this`. For an array of
|
| 49 |
+
length 1, the value of element 0 is returned. For all other array
|
| 50 |
+
lengths, the determination is made using `operator<`.
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
+
valarray shift(int n) const;
|
| 54 |
```
|
| 55 |
|
| 56 |
+
*Returns:* A `valarray` of length `size()`, each of whose elements *I*
|
| 57 |
+
is `(*this)[`*`I`*` + n]` if *`I`*` + n` is non-negative and less than
|
| 58 |
+
`size()`, otherwise `T()`.
|
| 59 |
+
|
| 60 |
+
[*Note 1*: If element zero is taken as the leftmost element, a positive
|
| 61 |
+
value of `n` shifts the elements left `n` places, with zero
|
| 62 |
+
fill. — *end note*]
|
| 63 |
+
|
| 64 |
+
[*Example 1*: If the argument has the value -2, the first two elements
|
| 65 |
+
of the result will be value-initialized ([[dcl.init]]); the third
|
| 66 |
+
element of the result will be assigned the value of the first element of
|
| 67 |
+
the argument; etc. — *end example*]
|
| 68 |
+
|
| 69 |
``` cpp
|
| 70 |
+
valarray cshift(int n) const;
|
| 71 |
```
|
| 72 |
|
| 73 |
+
*Returns:* A `valarray` of length `size()` that is a circular shift of
|
| 74 |
+
`*this`. If element zero is taken as the leftmost element, a
|
| 75 |
+
non-negative value of n shifts the elements circularly left n places and
|
| 76 |
+
a negative value of n shifts the elements circularly right -n places.
|
| 77 |
+
|
| 78 |
``` cpp
|
| 79 |
+
valarray apply(T func(T)) const;
|
| 80 |
+
valarray apply(T func(const T&)) const;
|
| 81 |
```
|
| 82 |
|
| 83 |
+
*Returns:* A `valarray` whose length is `size()`. Each element of the
|
| 84 |
+
returned array is assigned the value returned by applying the argument
|
| 85 |
+
function to the corresponding element of `*this`.
|
| 86 |
+
|
| 87 |
``` cpp
|
| 88 |
void resize(size_t sz, T c = T());
|
| 89 |
```
|
| 90 |
|
| 91 |
+
*Effects:* Changes the length of the `*this` array to `sz` and then
|
| 92 |
+
assigns to each element the value of the second argument. Resizing
|
| 93 |
+
invalidates all pointers and references to elements in the array.
|
| 94 |
+
|