Quick Links: |
#include <bslmf_movableref.h>
Classes | |
struct | AddLvalueReference |
struct | AddMovableReference |
struct | Decay |
struct | IsLvalueReference |
struct | IsMovableReference |
struct | IsReference |
struct | RemoveReference |
Static Public Member Functions | |
template<class t_TYPE > | |
static t_TYPE & | access (t_TYPE &ref) BSLS_KEYWORD_NOEXCEPT |
template<class t_TYPE > | |
static t_TYPE & | access (MovableRef< t_TYPE > ref) BSLS_KEYWORD_NOEXCEPT |
template<class t_TYPE > | |
static MovableRef< t_TYPE > | move (t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT |
template<class t_TYPE > | |
static MovableRef< typename bsl::remove_reference< t_TYPE > ::type > | move (MovableRef< t_TYPE > reference) BSLS_KEYWORD_NOEXCEPT |
template<class t_TYPE > | |
static bsl::enable_if < !bsl::is_nothrow_move_constructible < t_TYPE >::value &&bsl::is_copy_constructible < t_TYPE >::value, const t_TYPE & >::type | move_if_noexcept (t_TYPE &lvalue) BSLS_KEYWORD_NOEXCEPT |
template<class t_TYPE > | |
static bsl::enable_if < !bsl::is_copy_constructible < t_TYPE >::value||bsl::is_nothrow_move_constructible < t_TYPE >::value, MovableRef < t_TYPE > >::type | move_if_noexcept (t_TYPE &lvalue) BSLS_KEYWORD_NOEXCEPT |
This struct
provides a collection of utility functions operating on objects of type MovableRef<t_TYPE>
. The primary use of these utilities to create a consistent notation for using the C++03 MovableRef<t_TYPE>
objects and the C++11 t_TYPE&&
r-value references.
See Component bslmf_movableref
static t_TYPE& bslmf::MovableRefUtil::access | ( | t_TYPE & | ref | ) | [static] |
static t_TYPE& bslmf::MovableRefUtil::access | ( | MovableRef< t_TYPE > | ref | ) | [static] |
Return an lvalue reference to the object referenced by the specified ref
object. This function is used to provide a uniform interface to members of an object reference by ref
, regardless of whether ref
is an MovableRef
or lvalue reference and whether the compiler supports C++11 rvalue references. This function is unnecessary (but allowed) when simply converting ref
to t_TYPE&
.
Please see the component-level documentation for more information on this function.
static MovableRef<t_TYPE> bslmf::MovableRefUtil::move | ( | t_TYPE & | reference | ) | [static] |
Referenced by bslma::ConstructionUtil_Imp::construct(), bslma::ConstructionUtil_Imp::destructiveMove(), bslalg::ScalarPrimitives_Imp::moveConstruct(), bslalg::NothrowMovableWrapper< TYPE >::NothrowMovableWrapper(), bdlb::Variant_MoveAssignVisitor::operator()(), and bdlb::Variant_MoveConstructVisitor::operator()().
static MovableRef<typename bsl::remove_reference<t_TYPE>::type> bslmf::MovableRefUtil::move | ( | MovableRef< t_TYPE > | reference | ) | [static] |
Return a movable reference to the object referred to by the specified reference
. Note that the C++03 implementation of this function behaves like a factory for MovableRef<t_TYPE>
objects. The C++11 implementation of this function behaves exactly like std::move(value)
applied to lvalues.
static bsl::enable_if< !bsl::is_nothrow_move_constructible<t_TYPE>::value && bsl::is_copy_constructible<t_TYPE>::value, const t_TYPE&>::type bslmf::MovableRefUtil::move_if_noexcept | ( | t_TYPE & | lvalue | ) | [inline, static] |
< Return a const-qualified reference to the specified lvalue
. This function is selected by overload resolution if the move constructor for t_TYPE
might throw an exception. Constructing a t_TYPE
object from the result will result in the copy constructor being invoked rather than the (unsafe) move constructor.
static bsl::enable_if< !bsl::is_copy_constructible<t_TYPE>::value || bsl::is_nothrow_move_constructible<t_TYPE>::value, MovableRef<t_TYPE> >::type bslmf::MovableRefUtil::move_if_noexcept | ( | t_TYPE & | lvalue | ) | [inline, static] |
< Return a movable reference to the specified lvalue
. This function is selected by overload resolution if the move constructor for t_TYPE
is nothrow-move-constructible. Constructing a t_TYPE
object from the result will result in the (safe) move constructor being invoked. Note that that the bsl::is_nothrow_move_constructible
trait can be customized in C++03 mode to indicate that a type is nothrow-move-constructible.
References bsls::Util::addressOf().