mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 18:14:36 +03:00
Add const rvalue reference edge-case for ref-qualified member functions section.
This commit is contained in:
@@ -1188,6 +1188,7 @@ struct Foo {
|
||||
Bar getBar() & { return bar; }
|
||||
Bar getBar() const& { return bar; }
|
||||
Bar getBar() && { return std::move(bar); }
|
||||
Bar getBar() const&& { return std::move(bar); }
|
||||
private:
|
||||
Bar bar{};
|
||||
};
|
||||
@@ -1200,6 +1201,8 @@ Bar bar2 = foo2.getBar(); // calls `Bar Foo::getBar() const&`
|
||||
|
||||
Foo{}.getBar(); // calls `Bar Foo::getBar() &&`
|
||||
std::move(foo).getBar(); // calls `Bar Foo::getBar() &&`
|
||||
|
||||
std::move(foo2).getBar(); // calls `Bar Foo::getBar() const&&`
|
||||
```
|
||||
|
||||
## C++11 Library Features
|
||||
|
||||
Reference in New Issue
Block a user