BDE 4.14.0 Production release
|
Provide a compile-time type transformation to rvalue reference.
This component defines a meta-function, bsl::add_rvalue_reference
, that may be used to transform a type to its rvalue reference type.
bsl::add_rvalue_reference
and bsl::add_rvalue_reference_t
meet the requirements of the add_rvalue_reference
template defined in the C++11 standard [meta.trans.ref].
In this section we show intended use of this component.
Suppose that we want to transform some types to rvalue reference types.
Now, for a set of types, we transform each type to the corresponding rvalue reference of that type using bsl::add_rvalue_reference
and verify the result:
Finally, if the current compiler supports alias templates C++11 feature, we instantiate the bsl::add_rvalue_reference_t
template for the same set of types, and use the bsl::is_same
meta-function to assert the resultant type of each instantiation:
Note that rvalue reference was introduced in C++11 and may not be supported by all compilers. Note also that according to reference collapsing
semantics [8.3.2], add_rvalue_reference
does not transform t_TYPE
to rvalue reference type if t_TYPE
is an lvalue reference type.
Also note that the bsl::add_rvalue_reference_t
avoids the ::type
suffix and typename
prefix when we want to use the result of bsl::add_rvalue_reference
meta-function in templates.