Created
July 12, 2017 07:32
-
-
Save h-sao/8bc25ff069ff695e709c660622f18fec to your computer and use it in GitHub Desktop.
Rvalue/Lvalue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo{ | |
using Type = std::vector<Bar> | |
// 1 Lvalue | |
Type & data() & { return data_; } | |
// 2 Rvalue | |
Type data() && { return std::move ( data_ ); } | |
Type data_; | |
} | |
Foo makeFoo(); | |
auto v = makeFoo().data(); | |
auto v = std::move( makeFoo().data()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment