Quick Links: |
Provide a simple struct
with two members that may use allocators.
More...
Classes | |
struct | bsl::Pair_BslmaIdiom< TYPE > |
struct | bsl::Pair_ImpUtil |
struct | bsl::Pair_First< TYPE > |
struct | bsl::Pair_First< TYPE & > |
struct | bsl::Pair_Second< TYPE > |
struct | bsl::Pair_Second< TYPE & > |
class | bsl::pair< T1, T2 > |
Typedefs | |
typedef bsl::integral_constant < int, 1 > | bsl::Pair_BslmaIdiomAtEnd |
typedef bsl::integral_constant < int, 2 > | bsl::Pair_BslmaIdiomAllocatorArgT |
typedef T1 | bsl::pair::first_type |
typedef T2 | bsl::pair::second_type |
Functions | |
template<class TYPE > | |
void | std::swap (TYPE &a, TYPE &b) |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First::Pair_First () |
bsl::Pair_First::Pair_First (BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First::Pair_First (typename bsl::add_lvalue_reference< const TYPE >::type value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First::Pair_First (const PARAM &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First::Pair_First (PARAM &value) |
template<class PARAM > | |
bsl::Pair_First::Pair_First (const PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) | |
template<class PARAM > | |
bsl::Pair_First::Pair_First (PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) | |
bsl::Pair_First::Pair_First (const Pair_First &) | |
bsl::Pair_First::Pair_First (Pair_First &&) | |
Pair_First & | bsl::Pair_First::operator= (Pair_First &&) |
bsl::Pair_First::~Pair_First () | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First< TYPE & >::Pair_First (TYPE &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First< TYPE & >::Pair_First (const PARAM &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First< TYPE & >::Pair_First (PARAM &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First< TYPE & >::Pair_First (const PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_First< TYPE & >::Pair_First (PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) |
bsl::Pair_First< TYPE & >::~Pair_First () | |
Pair_First & | bsl::Pair_First< TYPE & >::operator= (const Pair_First &rhs) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second::Pair_Second () |
bsl::Pair_Second::Pair_Second (BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second::Pair_Second (typename bsl::add_lvalue_reference< const TYPE >::type value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second::Pair_Second (const PARAM &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second::Pair_Second (PARAM &value) |
template<class PARAM > | |
bsl::Pair_Second::Pair_Second (const PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) | |
template<class PARAM > | |
bsl::Pair_Second::Pair_Second (PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) | |
bsl::Pair_Second::Pair_Second (const Pair_Second &) | |
bsl::Pair_Second::Pair_Second (Pair_Second &&) | |
Pair_Second & | bsl::Pair_Second::operator= (Pair_Second &&) |
bsl::Pair_Second::~Pair_Second () | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second< TYPE & >::Pair_Second (TYPE &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second< TYPE & >::Pair_Second (const PARAM &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second< TYPE & >::Pair_Second (PARAM &value) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second< TYPE & >::Pair_Second (const PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) |
template<class PARAM > | |
BSLS_KEYWORD_CONSTEXPR | bsl::Pair_Second< TYPE & >::Pair_Second (PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone) |
bsl::Pair_Second< TYPE & >::~Pair_Second () | |
Pair_Second & | bsl::Pair_Second< TYPE & >::operator= (const Pair_Second &rhs) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair () |
bsl::pair::pair (BloombergLP::bslma::Allocator *basicAllocator) | |
bsl::pair::pair (const pair &original, BloombergLP::bslma::Allocator *basicAllocator) | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (BloombergLP::bslmf::MovableRef< pair > original) |
bsl::pair::pair (BloombergLP::bslmf::MovableRef< pair > original, BloombergLP::bslma::Allocator *basicAllocator) | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (typename bsl::add_lvalue_reference< const T1 >::type a, typename bsl::add_lvalue_reference< const T2 >::type b) |
bsl::pair::pair (typename bsl::add_lvalue_reference< const T1 >::type a, typename bsl::add_lvalue_reference< const T2 >::type b, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (const PARAM_1 &a, const PARAM_2 &b, typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type=0) |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (const PARAM_1 &a, const PARAM_2 &b, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (PARAM_1 &a, const PARAM_2 &b, typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type=0) |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (PARAM_1 &a, const PARAM_2 &b, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (const PARAM_1 &a, PARAM_2 &b, typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type=0) |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (const PARAM_1 &a, PARAM_2 &b, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (PARAM_1 &a, PARAM_2 &b, typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type=0) |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (PARAM_1 &a, PARAM_2 &b, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (const pair< PARAM_1, PARAM_2 > &other) |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (const std::pair< PARAM_1, PARAM_2 > &other) |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (const pair< PARAM_1, PARAM_2 > &other, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (const std::pair< PARAM_1, PARAM_2 > &other, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (BloombergLP::bslmf::MovableRef< pair< PARAM_1, PARAM_2 > > other, typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value, void * >::type=0) |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (BloombergLP::bslmf::MovableRef< std::pair< PARAM_1, PARAM_2 > > other, typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value, void * >::type=0) |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (BloombergLP::bslmf::MovableRef< pair< PARAM_1, PARAM_2 > > other, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
bsl::pair::pair (BloombergLP::bslmf::MovableRef< std::pair< PARAM_1, PARAM_2 > > other, BloombergLP::bslma::Allocator *basicAllocator) | |
template<class PARAM_1 , class PARAM_2 > | |
BSLS_KEYWORD_CONSTEXPR | bsl::pair::pair (const BloombergLP::bslma::ManagedPtr_PairProxy< PARAM_1, PARAM_2 > &rhs) |
bsl::pair::~pair () | |
template<class PARAM_1 , class PARAM_2 > | |
pair & | bsl::pair::operator= (const pair< PARAM_1, PARAM_2 > &rhs) |
pair & | bsl::pair::operator= (BloombergLP::bslmf::MovableRef< pair > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false) |
template<class PARAM_1 , class PARAM_2 > | |
pair & | bsl::pair::operator= (BloombergLP::bslmf::MovableRef< pair< PARAM_1, PARAM_2 > > rhs) |
template<class PARAM_1 , class PARAM_2 > | |
pair & | bsl::pair::operator= (const std::pair< PARAM_1, PARAM_2 > &rhs) |
template<class T1 , class T2 > | |
BSLS_KEYWORD_CONSTEXPR bool | bsl::operator== (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
template<class T1 , class T2 > | |
BSLS_KEYWORD_CONSTEXPR bool | bsl::operator!= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
template<class T1 , class T2 > | |
BSLS_KEYWORD_CONSTEXPR bool | bsl::operator< (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
template<class T1 , class T2 > | |
BSLS_KEYWORD_CONSTEXPR bool | bsl::operator> (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
template<class T1 , class T2 > | |
BSLS_KEYWORD_CONSTEXPR bool | bsl::operator<= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
template<class T1 , class T2 > | |
BSLS_KEYWORD_CONSTEXPR bool | bsl::operator>= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
template<class T1 , class T2 > | |
void | bsl::swap (pair< T1, T2 > &a, pair< T1, T2 > &b) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b))) |
template<class HASHALG , class T1 , class T2 > | |
void | bsl::hashAppend (HASHALG &hashAlg, const pair< T1, T2 > &input) |
Variables | |
TYPE | bsl::Pair_First::first |
TYPE | bsl::Pair_Second::second |
struct
with two members that may use allocators. bsl::pair | pair of values, each of which may use a bslma::Allocator |
bsl::pair
is an allocator-aware version of std::pair
. The bsl::pair
class template is instantiated on two types, T1
and T2
, and provides two public data members, first
and second
of types T1
and T2
, respectively. Each data member might or might not allocate memory using bslma::Allocator
. Its interface is identical to std::pair
except that it has constructors that take optional allocator arguments to correctly construct the member variables. For example, a bsl::pair<std::string, int>
has member first
of type std::string
and second
of type int
. A client can pass a bslma::Allocator
pointer to the pair constructor and the constructor will pass it through to the first
member. Similarly, the copy constructor takes an optional bslma::Allocator
pointer and copy-constructs the first
member using that allocator. bsl::pair
is unusual in that its data members, first
and second
, are public. Once constructed, a client program accesses these members directly. This part of the interface is identical to std::pair
, for which bsl::pair
is intended to be a drop-in replacement. bsl::pair
has four constructors: a default constructor that default-constructs the two data members, a copy constructor that copy-constructs each data member, a constructor taking two arguments of type T1
and T2
, which are used to copy-construct first
and second
respectively, and a conversion constructor template for converting from a bsl::pair
of different types, PARAM_1
and PARAM_2
, provided PARAM_1
is convertible to T1
and PARAM_2
is convertible to T2
. Each constructor also has an optional bslma::Allocator
pointer argument. If neither T1
nor T2
use bslma::Allocator
, this argument is ignored. Otherwise, either first
or second
, or both, depending on whether each type uses bslma::Allocator
, will be passed the bslma::Allocator*
argument during construction. Whether or not a type uses bslma::Allocator
is determined by querying the bslma::UsesBslmaAllocator
trait for that type. This component also defines a full set of equality and relational operators that can be instantiated if T1
and T2
both provide those operators. bsl::pair
declares a set of associated type traits that are computed from the type traits of T1
and T2
. For each supported type trait, a given specialization of bsl::pair
has that trait if and only if both T1
and T2
have that trait. Supported traits are: bslmf::IsBitwiseMoveable bslmf::IsBitwiseEqualityComparable bsl::is_trivially_copyable bsl::is_trivially_default_constructible
bsl::pair
specialization has the bslma::UsesBslmaAllocator
trait if either T1
or T2
have that trait, or both. pair
provides. This section describes such enhancements as they become available. = default
makes it possible to create special member functions that exists only when they can be implemented properly. bsl::pair
that stores a reference type (such as int&
), or any other type that cannot be default constructed using the syntax T v{};
will cause pair to neither declare nor define a default constructor. So from C++11 onwards a type of bsl::pair<T1, T2>
will have a default constructor only if both types T1
and T2
are default constructible. Otherwise, pair will have a default constructor that gives a compile-error (only) if called. bsl::pair
is a very simple object when used without allocators. Our usage example concentrates on the use of allocators with bsl::pair
. First, we create a utility function that copies a null-terminated string into memory allocated from a supplied allocator: char *myStrDup(const char *s, bslma::Allocator *basicAllocator) // Copy the specified null-terminated string 's' into memory allocated // from the specified 'basicAllocator' { char *result = (char*) basicAllocator->allocate(std::strlen(s) + 1); return std::strcpy(result, s); }
myStrDup
(above) in its implementation: class my_String { // Simple string class that uses a 'bslma::Allocator' allocator. bslma::Allocator *d_allocator_p; char *d_data; public: BSLMF_NESTED_TRAIT_DECLARATION(my_String, bslma::UsesBslmaAllocator); explicit my_String(bslma::Allocator *basicAllocator = 0); // Construct an empty string using the optionally-specified // allocator 'basicAllocator'. my_String(const char* s, bslma::Allocator *alloc = 0); // IMPLICIT // Construct a string with contents specified in 's' using the // optionally-specified allocator 'basicAllocator'. my_String(const my_String& rhs, bslma::Allocator *alloc = 0); // Construct a copy of the specified 'rhs' string using the // optionally-specified allocator 'basicAllocator'. ~my_String(); // Destroy this string. my_String& operator=(const my_String& rhs); // Copy specified 'rhs' string value to this string. const char* c_str() const; // Return the null-terminated character array for this string. bslma::Allocator *allocator() const; // Return the allocator used to construct this string or, if no // allocator was specified at construction, the default allocator // at the time of construction. }; bool operator==(const my_String& str1, const my_String& str2) { return 0 == std::strcmp(str1.c_str(), str2.c_str()); } bool operator==(const my_String& str, const char *p) { return 0 == std::strcmp(p, str.c_str()); } bool operator==(const char *p, const my_String& str) { return str == p; } bool operator!=(const my_String& str1, const my_String& str2) { return ! (str1 == str2); } bool operator!=(const my_String& str, const char *p) { return ! (str == p); } bool operator!=(const char *p, const my_String& str) { return ! (str == p); } bool operator<(const my_String& str1, const my_String& str2) { return std::strcmp(str1.c_str(), str2.c_str()) < 0; } my_String::my_String(bslma::Allocator *basicAllocator) : d_allocator_p(bslma::Default::allocator(basicAllocator)), d_data(0) { d_data = myStrDup("", d_allocator_p); } my_String::my_String(const char *s, bslma::Allocator *basicAllocator) : d_allocator_p(bslma::Default::allocator(basicAllocator)), d_data(0) { d_data = myStrDup(s, d_allocator_p); } my_String::my_String(const my_String& rhs, bslma::Allocator *basicAllocator) : d_allocator_p(bslma::Default::allocator(basicAllocator)), d_data(0) { d_data = myStrDup(rhs.d_data, d_allocator_p); } my_String::~my_String() { d_allocator_p->deallocate(d_data); } my_String& my_String::operator=(const my_String& rhs) { if (this != &rhs) { d_allocator_p->deallocate(d_data); d_data = myStrDup(rhs.d_data, d_allocator_p); } return *this; } const char *my_String::c_str() const { return d_data; } bslma::Allocator *my_String::allocator() const { return d_allocator_p; }
bsl::pair<my_String, int>
. The program allocates memory from a test allocator in order to ensure that there are no leaks: int main() { typedef bsl::pair<my_String, int> Node; Node *mapping[3]; bslma::TestAllocator alloc;
Node
, an allocator is supplied in addition to parameters for the first
and second
data members. { mapping[0] = new(basicAllocator) Node("One", 1, &basicAllocator); mapping[1] = new(basicAllocator) Node("Three", 3, &basicAllocator); mapping[2] = new(basicAllocator) Node("Two", 2, &basicAllocator); // Temporaries get destroyed here, even on broken compilers. } assert("One" == mapping[0]->first); assert(1 == mapping[0]->second); assert("Three" == mapping[1]->first); assert(3 == mapping[1]->second); assert("Two" == mapping[2]->first); assert(2 == mapping[2]->second); assert(6 == alloc.numBlocksInUse());
alloc.deleteObjectRaw(mapping[0]); alloc.deleteObjectRaw(mapping[1]); alloc.deleteObjectRaw(mapping[2]); assert(0 == alloc.numBlocksInUse()); return 0; }
typedef bsl::integral_constant<int, 1> bsl::Pair_BslmaIdiomAtEnd |
typedef bsl::integral_constant<int, 2> bsl::Pair_BslmaIdiomAllocatorArgT |
typedef T1 bsl::pair< T1, T2 >::first_type [inherited] |
typedef T2 bsl::pair< T1, T2 >::second_type [inherited] |
void std::swap | ( | TYPE & | a, | |
TYPE & | b | |||
) |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE >::Pair_First | ( | ) | [inherited] |
Construct the first
member of a pair
using the default constructor for (template parameter) TYPE
.
bsl::Pair_First< TYPE >::Pair_First | ( | BloombergLP::bslma::Allocator * | basicAllocator, | |
Pair_BslmaIdiomNone | ||||
) | [inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE >::Pair_First | ( | typename bsl::add_lvalue_reference< const TYPE >::type | value | ) | [explicit, inherited] |
Construct the first
member from the specified non-modifiable value
, without specifying an allocator.
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE >::Pair_First | ( | const PARAM & | value | ) | [explicit, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE >::Pair_First | ( | PARAM & | value | ) | [explicit, inherited] |
TBD: improve comment. Construct the first
member from the specified value
, without specifying an allocator. This function (perfectly) forwards value
to the constructor of (template parameter) TYPE
.
bsl::Pair_First< TYPE >::Pair_First | ( | const PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [inherited] |
bsl::Pair_First< TYPE >::Pair_First | ( | PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [inherited] |
bsl::Pair_First< TYPE >::Pair_First | ( | const Pair_First< TYPE > & | ) | [inherited] |
bsl::Pair_First< TYPE >::Pair_First | ( | Pair_First< TYPE > && | ) | [inherited] |
Pair_First& bsl::Pair_First< TYPE >::operator= | ( | Pair_First< TYPE > && | ) | [inherited] |
bsl::Pair_First< TYPE >::~Pair_First | ( | ) | [inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE & >::Pair_First | ( | TYPE & | value | ) | [explicit, protected, inherited] |
Bind the specified value
into the first
reference-member.
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE & >::Pair_First | ( | const PARAM & | value | ) | [explicit, protected, inherited] |
for derived-to-const-base-ref
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE & >::Pair_First | ( | PARAM & | value | ) | [explicit, protected, inherited] |
Bind the specified value
into the first
reference-member. TBD: Consider SFINAE-ing these constructors
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE & >::Pair_First | ( | const PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE & >::Pair_First | ( | PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [protected, inherited] |
Bind the specified value
into the first
reference-member. The specified basicAllocator
is not used.
bsl::Pair_First< TYPE & >::~Pair_First | ( | ) | [protected, inherited] |
Pair_First& bsl::Pair_First< TYPE & >::operator= | ( | const Pair_First< TYPE & > & | rhs | ) | [protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE >::Pair_Second | ( | ) | [protected, inherited] |
Construct the second
member of a pair
using the default constructor for (template parameter) type TYPE
.
bsl::Pair_Second< TYPE >::Pair_Second | ( | BloombergLP::bslma::Allocator * | basicAllocator, | |
Pair_BslmaIdiomNone | ||||
) | [protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE >::Pair_Second | ( | typename bsl::add_lvalue_reference< const TYPE >::type | value | ) | [explicit, protected, inherited] |
Construct the second
member from the specified non-modifiable value
, without specifying an allocator.
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE >::Pair_Second | ( | const PARAM & | value | ) | [explicit, protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE >::Pair_Second | ( | PARAM & | value | ) | [explicit, protected, inherited] |
Construct the second
member from the specified value
, without specifying an allocator. This function (perfectly) forwards value
to the constructor of (template parameter) TYPE
.
bsl::Pair_Second< TYPE >::Pair_Second | ( | const PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [protected, inherited] |
bsl::Pair_Second< TYPE >::Pair_Second | ( | PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [protected, inherited] |
bsl::Pair_Second< TYPE >::Pair_Second | ( | const Pair_Second< TYPE > & | ) | [protected, inherited] |
bsl::Pair_Second< TYPE >::Pair_Second | ( | Pair_Second< TYPE > && | ) | [protected, inherited] |
Pair_Second& bsl::Pair_Second< TYPE >::operator= | ( | Pair_Second< TYPE > && | ) | [protected, inherited] |
bsl::Pair_Second< TYPE >::~Pair_Second | ( | ) | [protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE & >::Pair_Second | ( | TYPE & | value | ) | [explicit, protected, inherited] |
Construct the second
member from the specified non-modifiable value
, without specifying an allocator.
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE & >::Pair_Second | ( | const PARAM & | value | ) | [explicit, protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE & >::Pair_Second | ( | PARAM & | value | ) | [explicit, protected, inherited] |
Construct the second
member from the specified value
, without specifying an allocator. This function (perfectly) forwards value
to the constructor of (template parameter) TYPE
.
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE & >::Pair_Second | ( | const PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::Pair_Second< TYPE & >::Pair_Second | ( | PARAM & | value, | |
BloombergLP::bslma::Allocator * | basicAllocator, | |||
Pair_BslmaIdiomNone | ||||
) | [protected, inherited] |
Construct the second
member of a pair
from the specified forwarding reference value
, using the specified basicAllocator
to supply memory. This function (perfectly) forwards value
to the constructor of (template parameter) TYPE
. Note that exactly one of these three constructors is enabled at compile-time for (template parameter) type TYPE
based on the following respective criteria: 1) TYPE
does not support bslma
-style allocators, 2) TYPE
takes a bslma
-style allocator as the last constructor argument, and 3) TYPE
takes a bslma
-style allocator as the second constructor argument preceded by bsl::allocator_arg
.
bsl::Pair_Second< TYPE & >::~Pair_Second | ( | ) | [protected, inherited] |
Pair_Second& bsl::Pair_Second< TYPE & >::operator= | ( | const Pair_Second< TYPE & > & | rhs | ) | [protected, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | ) | [inherited] |
bsl::pair< T1, T2 >::pair | ( | BloombergLP::bslma::Allocator * | basicAllocator | ) | [explicit, inherited] |
Construct a pair
with the first
and second
members initialized to default values. Optionally specify a basicAllocator
, used to supply memory for each of first
and second
when its type (template parameter T1
or T2
, respectively) uses bslma
-style allocators. This method requires that T1
and T2
be default-constructible.
bsl::pair< T1, T2 >::pair | ( | const pair< T1, T2 > & | original, | |
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
Construct a pair
having the same value as that of the specified original
pair. Optionally specify a basicAllocator
, used to supply memory for each of first
and second
when its type (template parameter T1
or T2
, respectively) uses bslma
-style allocators. Note that the copy constructor is implicitly declared (if T1
and T2
are both copy-constructible
) by compilers that do not support defaulted declarations.
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | BloombergLP::bslmf::MovableRef< pair< T1, T2 > > | original | ) | [inherited] |
bsl::pair< T1, T2 >::pair | ( | BloombergLP::bslmf::MovableRef< pair< T1, T2 > > | original, | |
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
Construct a pair having the same value as that of the specified original
before the call to the move constructor. Optionally specify a basicAllocator
, used to supply memory for each of first
and second
when its type (template parameter T1
or T2
, respectively) uses bslma
-style allocators. Note that original
is left in a valid but unspecified state. Also note that this method requires that T1
and T2
be move-constructible. Note that the move constructor is implicitly declared (if T1
and T2
are both move-constructible) by compilers that do not support defaulted declarations, but do support rvalue references.
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | typename bsl::add_lvalue_reference< const T1 >::type | a, | |
typename bsl::add_lvalue_reference< const T2 >::type | b | |||
) | [inherited] |
bsl::pair< T1, T2 >::pair | ( | typename bsl::add_lvalue_reference< const T1 >::type | a, | |
typename bsl::add_lvalue_reference< const T2 >::type | b, | |||
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
Construct a pair
with the first
member initialized to the specified a
value and the second
member initialized to the specified b
value. Optionally specify a basicAllocator
, used to supply memory for each of first
and second
when its type (template parameter T1
or T2
, respectively) uses bslma
-style allocators. This method requires that T1
and T2
be copy-constructible
.
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | const PARAM_1 & | a, | |
const PARAM_2 & | b, | |||
typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type | = 0 | |||
) | [inline, inherited] |
bsl::pair< T1, T2 >::pair | ( | const PARAM_1 & | a, | |
const PARAM_2 & | b, | |||
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | PARAM_1 & | a, | |
const PARAM_2 & | b, | |||
typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type | = 0 | |||
) | [inline, inherited] |
bsl::pair< T1, T2 >::pair | ( | PARAM_1 & | a, | |
const PARAM_2 & | b, | |||
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | const PARAM_1 & | a, | |
PARAM_2 & | b, | |||
typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type | = 0 | |||
) | [inline, inherited] |
bsl::pair< T1, T2 >::pair | ( | const PARAM_1 & | a, | |
PARAM_2 & | b, | |||
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | PARAM_1 & | a, | |
PARAM_2 & | b, | |||
typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value &&!(bsl::is_pointer< typenamebsl::remove_reference< PARAM_2 >::type >::value &&bsl::is_convertible< PARAM_2, BloombergLP::bslma::Allocator * >::value), void * >::type | = 0 | |||
) | [inline, inherited] |
bsl::pair< T1, T2 >::pair | ( | PARAM_1 & | a, | |
PARAM_2 & | b, | |||
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
Construct a pair with the first
member initialized to the specified a
value of (template parameter) type PARAM_1
and the second
member initialized to the specified b
value of (template parameter) type PARAM_2
. Optionally specify a basicAllocator
, used to supply memory for each of first
and second
when its type (template parameter T1
or T2
, respectively) uses bslma
-style allocators. This method requires that T1
and T2
be convertible from PARAM_1
and PARAM_2
, respectively.
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | const pair< PARAM_1, PARAM_2 > & | other | ) | [inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | const std::pair< PARAM_1, PARAM_2 > & | other | ) | [inherited] |
bsl::pair< T1, T2 >::pair | ( | const pair< PARAM_1, PARAM_2 > & | other, | |
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
bsl::pair< T1, T2 >::pair | ( | const std::pair< PARAM_1, PARAM_2 > & | other, | |
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
Construct a pair
from the specified other
pair, holding first
and second
values of (template parameter) type PARAM_1
and PARAM_2
respectively. Optionally specify a basicAllocator
, used to supply memory for each of first
and second
when its type (template parameter T1
or T2
, respectively) uses bslma
-style allocators. This method requires that T1
and T2
be convertible from PARAM_1
and PARAM_2
, respectively.
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | BloombergLP::bslmf::MovableRef< pair< PARAM_1, PARAM_2 > > | other, | |
typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value, void * >::type | = 0 | |||
) | [inline, inherited] |
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | BloombergLP::bslmf::MovableRef< std::pair< PARAM_1, PARAM_2 > > | other, | |
typename bsl::enable_if< bsl::is_convertible< PARAM_1, T1 >::value &&bsl::is_convertible< PARAM_2, T2 >::value, void * >::type | = 0 | |||
) | [inline, inherited] |
bsl::pair< T1, T2 >::pair | ( | BloombergLP::bslmf::MovableRef< pair< PARAM_1, PARAM_2 > > | other, | |
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
bsl::pair< T1, T2 >::pair | ( | BloombergLP::bslmf::MovableRef< std::pair< PARAM_1, PARAM_2 > > | other, | |
BloombergLP::bslma::Allocator * | basicAllocator | |||
) | [inherited] |
Construct a pair
from the specified other
pair, holding first
and second
values of (template parameter) type PARAM_1
and PARAM_2
respectively. Optionally specify a basicAllocator
, used to supply memory for each of first
and second
when its type (template parameter T1
or T2
, respectively) uses bslma
-style allocators. This method requires that T1
and T2
be convertible from PARAM_1
and PARAM_2
, respectively.
BSLS_KEYWORD_CONSTEXPR bsl::pair< T1, T2 >::pair | ( | const BloombergLP::bslma::ManagedPtr_PairProxy< PARAM_1, PARAM_2 > & | rhs | ) | [inherited] |
IMPLICIT: Create a pair
that has the same value as the specified rhs
pair proxy. The behavior is undefined unless T1
is constructible from PARAM_1
and T2
is constructible from from PARAM_2
.
bsl::pair< T1, T2 >::~pair | ( | ) | [inherited] |
Destroy this object. Call destructors on first
and second
.
pair& bsl::pair< T1, T2 >::operator= | ( | const pair< PARAM_1, PARAM_2 > & | rhs | ) | [inherited] |
Assign to this pair
from the specified rhs
pair, holding the parameterized types PARAM_1
and PARAM_2
, and return a reference offering modifiable access to this object. Assign first
the value in rhs.first
and second
the value in rhs.second
. Attempted use of this assignment operator will not compile unless both T1
and T2
supply assignment operators, and T1
is assignable from PARAM_1
and T2
is assignable from PARAM_2
.
pair& bsl::pair< T1, T2 >::operator= | ( | BloombergLP::bslmf::MovableRef< pair< T1, T2 > > | rhs | ) | [inherited] |
Assign to this pair
the value of the specified rhs
pair (before the call to the assignment), and return a reference providing modifiable access to this object. Note that rhs
is left in a valid but unspecified state. This method requires that (template parameter) types T1
and T2
be move-assignable.
pair& bsl::pair< T1, T2 >::operator= | ( | BloombergLP::bslmf::MovableRef< pair< PARAM_1, PARAM_2 > > | rhs | ) | [inherited] |
Assign to this pair
the value of the specified rhs
pair, holding first
and second
values of (template parameter) types PARAM_1
and PARAM_2
respectively, and return a reference providing modifiable access to this object. This method requires that T1
be assignable from PARAM_1
and T2
be assignable from PARAM_2
.
pair& bsl::pair< T1, T2 >::operator= | ( | const std::pair< PARAM_1, PARAM_2 > & | rhs | ) | [inherited] |
Assign to this pair
from the specified rhs
pair, where the type rhs
is the pair type native to the compiler's library, holding the parameterized types PARAM_1
and PARAM_2
, and return a reference offering modifiable access to this object. Assign first
the value in rhs.first
and second
the value in rhs.second
. Attempted use of this assignment operator will not compile unless both T1
and T2
supply assignment operators, and T1
is assignable from PARAM_1
and T2
is assignable from PARAM_2
.
BSLS_KEYWORD_CONSTEXPR bool bsl::operator== | ( | const pair< T1, T2 > & | lhs, | |
const pair< T1, T2 > & | rhs | |||
) | [inline] |
Return true if the specified lhs
and rhs
pair objects have the same value and false otherwise. lhs
has the same value as rhs
if lhs.first == rhs.first
and lhs.second == rhs.second
. A call to this operator will not compile unless both T1
and T2
supply operator==
.
BSLS_KEYWORD_CONSTEXPR bool bsl::operator!= | ( | const pair< T1, T2 > & | lhs, | |
const pair< T1, T2 > & | rhs | |||
) | [inline] |
Return true if the specified lhs
and rhs
pair objects do not have the same value and false otherwise. lhs
does not have the same value as rhs
if lhs == rhs
would return false. A call to this operator will not compile unless a call to lhs == rhs
would compile.
BSLS_KEYWORD_CONSTEXPR bool bsl::operator< | ( | const pair< T1, T2 > & | lhs, | |
const pair< T1, T2 > & | rhs | |||
) | [inline] |
Return true if the specified lhs
has a value less than the specified rhs
and false otherwise. Whether or not lhs
is less than rhs
is determined by a lexicographical comparison of the first
and second
data members of lhs
and rhs
. In other words: return true if lhs.first < rhs.first
and false if rhs.first < lhs.first
, otherwise return lhs.second < rhs.second
. A call to this operator will not compile unless both T1
and T2
supply operator<
.
BSLS_KEYWORD_CONSTEXPR bool bsl::operator> | ( | const pair< T1, T2 > & | lhs, | |
const pair< T1, T2 > & | rhs | |||
) | [inline] |
Return true if the specified lhs
has a value greater than the specified rhs
and false otherwise. lhs
has a value greater than rhs
if rhs
< lhs
would return true. A call to this operator will not compile unless a call to lhs < rhs
would compile.
BSLS_KEYWORD_CONSTEXPR bool bsl::operator<= | ( | const pair< T1, T2 > & | lhs, | |
const pair< T1, T2 > & | rhs | |||
) | [inline] |
Return true if the specified lhs
has a value less than or equal to the specified rhs
and false otherwise. lhs
has a value less than or equal to rhs
if rhs
< lhs
would return false. A call to this operator will not compile unless a call to lhs < rhs
would compile.
BSLS_KEYWORD_CONSTEXPR bool bsl::operator>= | ( | const pair< T1, T2 > & | lhs, | |
const pair< T1, T2 > & | rhs | |||
) | [inline] |
Return true if the specified lhs
has a value greater than or equal to the specified rhs
and false otherwise. lhs
has a value greater than or equal to rhs
if lhs
< rhs
would return false. A call to this operator will not compile unless a call to lhs < rhs
would compile.
void bsl::swap | ( | pair< T1, T2 > & | a, | |
pair< T1, T2 > & | b | |||
) |
Swap the values of the specified a
and b
pairs by applying swap
to each of the first
and second
pair fields. Note that this method is no-throw only if swap
on each field is no-throw.
void bsl::hashAppend | ( | HASHALG & | hashAlg, | |
const pair< T1, T2 > & | input | |||
) |
Pass the specified input
to the specified hashAlg
TYPE bsl::Pair_First< TYPE >::first [inherited] |
TYPE bsl::Pair_Second< TYPE >::second [protected, inherited] |