tmp/tmpu2kqda8u/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Concept <a id="iterator.concept.writable">[[iterator.concept.writable]]</a>
|
| 2 |
+
|
| 3 |
+
The `indirectly_writable` concept specifies the requirements for writing
|
| 4 |
+
a value into an iterator’s referenced object.
|
| 5 |
+
|
| 6 |
+
``` cpp
|
| 7 |
+
template<class Out, class T>
|
| 8 |
+
concept indirectly_writable =
|
| 9 |
+
requires(Out&& o, T&& t) {
|
| 10 |
+
*o = std::forward<T>(t); // not required to be equality-preserving
|
| 11 |
+
*std::forward<Out>(o) = std::forward<T>(t); // not required to be equality-preserving
|
| 12 |
+
const_cast<const iter_reference_t<Out>&&>(*o) =
|
| 13 |
+
std::forward<T>(t); // not required to be equality-preserving
|
| 14 |
+
const_cast<const iter_reference_t<Out>&&>(*std::forward<Out>(o)) =
|
| 15 |
+
std::forward<T>(t); // not required to be equality-preserving
|
| 16 |
+
};
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
Let `E` be an expression such that `decltype((E))` is `T`, and let `o`
|
| 20 |
+
be a dereferenceable object of type `Out`. `Out` and `T` model
|
| 21 |
+
`indirectly_writable<Out, T>` only if
|
| 22 |
+
|
| 23 |
+
- If `Out` and `T` model
|
| 24 |
+
`indirectly_readable<Out> && same_as<iter_value_t<Out>, decay_t<T>{>}`,
|
| 25 |
+
then `*o` after any above assignment is equal to the value of `E`
|
| 26 |
+
before the assignment.
|
| 27 |
+
|
| 28 |
+
After evaluating any above assignment expression, `o` is not required to
|
| 29 |
+
be dereferenceable.
|
| 30 |
+
|
| 31 |
+
If `E` is an xvalue [[basic.lval]], the resulting state of the object it
|
| 32 |
+
denotes is valid but unspecified [[lib.types.movedfrom]].
|
| 33 |
+
|
| 34 |
+
[*Note 1*: The only valid use of an `operator*` is on the left side of
|
| 35 |
+
the assignment statement. Assignment through the same value of the
|
| 36 |
+
indirectly writable type happens only once. — *end note*]
|
| 37 |
+
|
| 38 |
+
[*Note 2*: `indirectly_writable` has the awkward `const_cast`
|
| 39 |
+
expressions to reject iterators with prvalue non-proxy reference types
|
| 40 |
+
that permit rvalue assignment but do not also permit `const` rvalue
|
| 41 |
+
assignment. Consequently, an iterator type `I` that returns
|
| 42 |
+
`std::string` by value does not model
|
| 43 |
+
`indirectly_writable<I, std::string>`. — *end note*]
|
| 44 |
+
|