proxygen
|
#include <RValueReferenceWrapper.h>
Public Types | |
using | type = T |
Public Member Functions | |
rvalue_reference_wrapper () noexcept | |
rvalue_reference_wrapper (T &&ref) noexcept | |
rvalue_reference_wrapper (T &) noexcept=delete | |
rvalue_reference_wrapper (rvalue_reference_wrapper< T > &&other) noexcept | |
rvalue_reference_wrapper & | operator= (rvalue_reference_wrapper &&other) noexcept |
operator T && ()&&noexcept | |
T && | get ()&&noexcept |
template<class... Args> | |
decltype(auto) | operator() (Args &&...args)&&noexcept(noexcept(std::declval< T >()(std::forward< Args >(args)...))) |
bool | valid () const noexcept |
Private Member Functions | |
rvalue_reference_wrapper (const rvalue_reference_wrapper &)=delete | |
rvalue_reference_wrapper & | operator= (const rvalue_reference_wrapper &)=delete |
Private Attributes | |
T * | ptr_ |
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.)
Definition at line 42 of file RValueReferenceWrapper.h.
using folly::rvalue_reference_wrapper< T >::type = T |
Definition at line 44 of file RValueReferenceWrapper.h.
|
inlinenoexcept |
Default constructor. Creates an invalid reference. Must be move-assigned to in order to be come valid.
Definition at line 50 of file RValueReferenceWrapper.h.
Referenced by folly::rvalue_reference_wrapper< T >::rvalue_reference_wrapper(), and folly::rvalue_reference_wrapper< T >::valid().
|
inlineexplicitnoexcept |
Explicit constructor to make it harder to accidentally create a dangling reference to a temporary.
Definition at line 56 of file RValueReferenceWrapper.h.
References folly::pushmi::__adl::noexcept(), folly::rvalue_reference_wrapper< T >::rvalue_reference_wrapper(), and folly::T.
|
explicitdeletenoexcept |
No construction from lvalue reference. Use std::move.
|
inlinenoexcept |
|
privatedelete |
|
inlinenoexcept |
Explicit unwrap. Destructive.
Definition at line 92 of file RValueReferenceWrapper.h.
References testing::Args(), folly::rvalue_reference_wrapper< T >::ptr_, folly::T, and folly::rvalue_reference_wrapper< T >::valid().
Referenced by folly::rvalue_reference_wrapper< T >::operator T &&(), and folly::rvalue_reference_wrapper< T >::operator()().
|
inlinenoexcept |
Implicit conversion to raw reference. Destructive.
Definition at line 85 of file RValueReferenceWrapper.h.
References folly::rvalue_reference_wrapper< T >::get().
|
inlinenoexcept |
Calls the callable object to whom reference is stored. Only available if the wrapped reference points to a callable object. Destructive.
Definition at line 104 of file RValueReferenceWrapper.h.
References folly::rvalue_reference_wrapper< T >::get().
|
inlinenoexcept |
Destructive move assignment.
Definition at line 75 of file RValueReferenceWrapper.h.
References folly::rvalue_reference_wrapper< T >::ptr_.
Referenced by folly::rvalue_reference_wrapper< T >::valid().
|
privatedelete |
|
inlinenoexcept |
Check whether wrapped reference is valid.
Definition at line 113 of file RValueReferenceWrapper.h.
References folly::rvalue_reference_wrapper< T >::operator=(), folly::rvalue_reference_wrapper< T >::ptr_, and folly::rvalue_reference_wrapper< T >::rvalue_reference_wrapper().
Referenced by folly::rvalue_reference_wrapper< T >::get().
|
private |
Definition at line 123 of file RValueReferenceWrapper.h.
Referenced by folly::rvalue_reference_wrapper< T >::get(), folly::rvalue_reference_wrapper< T >::operator=(), and folly::rvalue_reference_wrapper< T >::valid().