folly::copy
Summary:
[Folly] `folly::copy`.
Usable when you have a function with two overloads:
class MyData;
void something(MyData&&);
void something(const MyData&);
Where the purpose is to make copies and moves explicit without having to spell out the full type names - in this case, for copies, to invoke copy constructors.
When the caller wants to pass a copy of an lvalue, the caller may:
void foo() {
MyData data;
something(folly::copy(data)); // explicit copy
something(std::move(data)); // explicit move
something(data); // const& - neither move nor copy
}
Reviewed By: markisaa, ericniebler
Differential Revision:
D3462023
fbshipit-source-id:
6c777be288f2a7012c1b4b46dc988890b8662595