01-10-2024, 12:28 PM
Are partial moves allowed by A8-4-5? If not, why not?
For example, consider the following snippet from Effective Modern C++ (Meyers), Item 25, page 169:
For example, consider the following snippet from Effective Modern C++ (Meyers), Item 25, page 169:
Code:
class Widget {
public:
Widget(Widget&& rhs)
: name(std::move(rhs.name)),
p(std::move(rhs.p))
{ … }
…
// rhs is rvalue reference
private:
std::string name;
std::shared_ptr<SomeDataStructure> p;
};