Class template that wraps a reference to an rvalue. Similar to std::reference_wrapper but with three important differences:
Declared in <folly/lang/RValueReferenceWrapper.h>
template<class T>
class rvalue_reference_wrapper;
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.)
| Name | Description |
|---|---|
type | The referenced value type. |
| Name | Description |
|---|---|
rvalue_reference_wrapper [constructor] | Constructors |
operator= | Destructive move assignment. |
get | Explicit unwrap. Destructive. |
operator() | Calls the callable object to whom reference is stored. Only available if the wrapped reference points to a callable object. Destructive. |
valid | Check whether wrapped reference is valid. |
operator T&& | Implicit conversion to raw reference. Destructive. |