folly::rvalue_reference_wrapper for store&forward of rvalue references
Summary: Class template that wraps a reference to an rvalue. Similar to std::reference_wrapper but with three important differences: 1) folly::rvalue_reference_wrappers can only be moved, not copied; 2) the get() function and the conversion-to-T operator are destructive and not const, they invalidate the wrapper; 3) the constructor-from-T is explicit. These restrictions are designed to make it harder to accidentally create a a dangling rvalue reference, or to use an rvalue reference multiple times. (Using an rvalue reference typically implies invalidation of the target object, such as move-assignment to another object.) Reviewed By: yfeldblum Differential Revision: D4931483 fbshipit-source-id: 68453553bf4656ec41976699669a4491fcab79c9
Showing
folly/Functional.h
0 → 100644
Please register or sign in to comment