BDE 4.14.0 Production release
|
Macros | |
#define | bslmf_RemoveReference bslmf::RemoveReference |
This alias is defined for backward compatibility. | |
Provide a meta-function for stripping reference-ness from types.
This component defines two meta-functions, bsl::remove_reference
and BloombergLP::bslmf::RemoveReference
, both of which may be used to strip reference-ness (including both lvalue and rvalue reference-ness, if the latter is supported by the compiler) from a type.
bsl::remove_reference
meets the requirements of the remove_reference template defined in the C++11 standard [meta.trans.ref], while bslmf::RemoveReference
was devised before remove_reference was standardized.
The two meta-functions are functionally equivalent. The major difference between them is that the result for bsl::remove_reference
is indicated by the class member type
, while the result for bslmf::RemoveReference
is indicated by the class member Type
.
Note that bsl::remove_reference
should be preferred over bslmf::RemoveReference
, and in general, should be used by new components.
In this section we show intended use of this component.
Suppose that we want to remove the reference-ness of a set of types.
Now, remove the reference-ness of a set of types using bsl::remove_reference
and verify that the returned type has any reference-ness removed:
Finally, if the current compiler supports alias templates C++11 feature, we remove reference-ness from a set of types using bsl::remove_reference_t
and verify that the resulting type has any reference-ness removed:
Note that rvalue reference is a feature introduced in the C++11 standard and may not be supported by all compilers.
Also note, that the bsl::remove_reference_t
avoids the ::type
suffix and typename
prefix when we want to use the result of the bsl::remove_reference
meta-function in templates.
#define bslmf_RemoveReference bslmf::RemoveReference |