mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 18:14:36 +03:00
Fix incorrect example and inconsistent forwarding references section.
This commit is contained in:
@@ -696,6 +696,13 @@ void f(T&& t) {
|
||||
int x = 0;
|
||||
f(0); // deduces as f(int&&)
|
||||
f(x); // deduces as f(int&)
|
||||
|
||||
int& y = x;
|
||||
f(y); // deduces as f(int& &&) => f(int&)
|
||||
|
||||
int&& z = 0; // NOTE: `z` is an lvalue with type `int&&`.
|
||||
f(z); // deduces as f(int&& &) => f(int&&)
|
||||
f(std::move(z)); // deduces as f(int&& &&) => f(int&&)
|
||||
```
|
||||
|
||||
See also: [`std::move`](#stdmove), [`std::forward`](#stdforward), [`rvalue references`](#rvalue-references).
|
||||
|
||||
Reference in New Issue
Block a user