tmp/tmpovh5t3jg/{from.md → to.md}
RENAMED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
### Forward/move helpers <a id="forward">[[forward]]</a>
|
| 2 |
|
| 3 |
The library provides templated helper functions to simplify applying
|
| 4 |
move semantics to an lvalue and to simplify the implementation of
|
| 5 |
forwarding functions. All functions specified in this subclause are
|
| 6 |
-
signal-safe
|
| 7 |
|
| 8 |
``` cpp
|
| 9 |
template<class T> constexpr T&& forward(remove_reference_t<T>& t) noexcept;
|
| 10 |
template<class T> constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
|
| 11 |
```
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
*Returns:* `static_cast<T&&>(t)`.
|
| 14 |
|
| 15 |
-
*Remarks:* If the second form is instantiated with an lvalue reference
|
| 16 |
-
type, the program is ill-formed.
|
| 17 |
-
|
| 18 |
[*Example 1*:
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
template<class T, class A1, class A2>
|
| 22 |
shared_ptr<T> factory(A1&& a1, A2&& a2) {
|
|
|
|
| 1 |
### Forward/move helpers <a id="forward">[[forward]]</a>
|
| 2 |
|
| 3 |
The library provides templated helper functions to simplify applying
|
| 4 |
move semantics to an lvalue and to simplify the implementation of
|
| 5 |
forwarding functions. All functions specified in this subclause are
|
| 6 |
+
signal-safe [[support.signal]].
|
| 7 |
|
| 8 |
``` cpp
|
| 9 |
template<class T> constexpr T&& forward(remove_reference_t<T>& t) noexcept;
|
| 10 |
template<class T> constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
|
| 11 |
```
|
| 12 |
|
| 13 |
+
*Mandates:* For the second overload, `is_lvalue_reference_v<T>` is
|
| 14 |
+
`false`.
|
| 15 |
+
|
| 16 |
*Returns:* `static_cast<T&&>(t)`.
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
[*Example 1*:
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
template<class T, class A1, class A2>
|
| 22 |
shared_ptr<T> factory(A1&& a1, A2&& a2) {
|