Provide a compile-time check for the bsl::pair type.
More...
Namespaces |
namespace | bslmf |
Detailed Description
- Outline
-
-
- Purpose:
- Provide a compile-time check for the bsl::pair type.
-
- Classes:
-
- See also:
-
- Description:
- This component defines a simple template structure used to evaluate whether it's parameter is a
bsl::pair
type. A t_TYPE
that has this trait fulfills the following requirements, where mX
is a modifiable object and X
a non-modifiable object of t_TYPE
: Valid expression Type
---------------- ----
t_TYPE::first_type
t_TYPE::second_type
mX.first first_type
mX.second second_type
X.first const first_type
X.second const second_type
Note that first
and second
are not member functions, but data members.
-
- Usage notes:
- The
bslmf::IsPair
trait is not used to construct pair objects, as a pair behaves like any other type w.r.t. the constructors and bslma::Allocator
. Nevertheless, it is used for different purposes in libraries that depend on bslalg
. For instance, some libraries use it for printing (a pair does not have a printing method, but it is possible to use the trait to forward the call to print
to its two members if they both have the printable trait).