BloombergLP::bslmf::MovableRefUtil::move_if_noexcept

Return a const-qualified reference to the specified lvalue.

Synopsis

Declared in <bslmf_movableref.h>

template<class t_TYPE>
static
t_TYPE const&
move_if_noexcept(t_TYPE& lvalue) noexcept
requires !bsl::is_nothrow_move_constructible<t_TYPE>::value &&
            bsl::is_copy_constructible<t_TYPE>::value;

Description

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.

Return Value

a const-qualified reference to lvalue

Parameters

NameDescription
lvalueobject to which a const reference is returned