mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 10:04:35 +03:00
Unsafe example.
This commit is contained in:
@@ -348,8 +348,9 @@ auto& f(T& t) {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto g = [](auto x) -> auto& { return f(x); };
|
auto g = [](auto& x) -> auto& { return f(x); };
|
||||||
int& y = g(123); // reference to `x`
|
int y = 123;
|
||||||
|
int& z = g(y); // reference to `y`
|
||||||
```
|
```
|
||||||
|
|
||||||
### decltype(auto)
|
### decltype(auto)
|
||||||
|
|||||||
Reference in New Issue
Block a user