BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bsl::Pair_First< TYPE > Struct Template Reference

#include <bslstl_pair.h>

Inheritance diagram for bsl::Pair_First< TYPE >:
bsl::pair< bsl::string, int > bsl::pair< KEY, VALUE > bsl::pair< int, unsigned >

Detailed Description

template<class TYPE>
struct bsl::Pair_First< TYPE >

This component-private class holds the first data member of a pair and constructs it appropriately. Note the partial specializations below for the cases that (template parameter) 'TYPE' is a reference.

See bslstl_pair

Protected Member Functions

 Pair_First (const Pair_First &)=default
 
 Pair_First (Pair_First &&)=default
 
Pair_Firstoperator= (const Pair_First &)=default
 
Pair_Firstoperator= (Pair_First &&)=default
 
 ~Pair_First ()=default
 
 Pair_First ()
 
 Pair_First (BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone)
 
 Pair_First (BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomAtEnd)
 
 Pair_First (BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomAllocatorArgT)
 
BSLS_KEYWORD_CONSTEXPR Pair_First (typename bsl::add_lvalue_reference< const TYPE >::type value)
 
template<class PARAM >
 Pair_First (const PARAM &value)
 
template<class PARAM >
 Pair_First (PARAM &value)
 
template<class PARAM >
 Pair_First (const PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone)
 
template<class PARAM >
 Pair_First (PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomNone)
 
template<class PARAM >
 Pair_First (const PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomAtEnd)
 
template<class PARAM >
 Pair_First (PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomAtEnd)
 
template<class PARAM >
 Pair_First (const PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomAllocatorArgT)
 
template<class PARAM >
 Pair_First (PARAM &value, BloombergLP::bslma::Allocator *basicAllocator, Pair_BslmaIdiomAllocatorArgT)
 

Protected Attributes

TYPE first
 

Constructor & Destructor Documentation

◆ Pair_First() [1/15]

template<class TYPE >
bsl::Pair_First< TYPE >::Pair_First ( const Pair_First< TYPE > &  )
protecteddefault

We must rely on implicitly declared special member functions to correctly support element types like bslma::ManagedPtr that have an unconventional copy constructor taking its argument by non-const reference. If we were to explicitly default these members then we would be forcing the copy constructor parameter to be const TYPE & whereas the implicitly declared constructor parameter will be TYPE &. We must then allow the move operations to be implicitly declared as if we explicitly default them then the copy operations would be deleted. As these operations are implicitly declared they will similarly be trivial, constexpr, noexcept, explicit, deleted, or (in the case of move operations) omitted according to the definition of (template parameter) TYPE.

Note
Note that, to preserve its intended use as a structural base class, the rest of the class is declared as protected while the implicitly declared members will be public.
Note that we must define the default constructor as a) it would not be declared due to the declarations of additional constructors, and b) we need to ensure that trivial types are value initialized rather than not initialized. Finally note that as of C++20, an explicitly defaulted special member would handle the case of non-const qualified copy operations correctly; we retain this convention while we continue to support C++17 and earlier dialects, but also embracing "rule of zero" as a widely regarded best practice.

◆ Pair_First() [2/15]

template<class TYPE >
bsl::Pair_First< TYPE >::Pair_First ( Pair_First< TYPE > &&  )
protecteddefault

◆ ~Pair_First()

template<class TYPE >
bsl::Pair_First< TYPE >::~Pair_First ( )
protecteddefault

◆ Pair_First() [3/15]

template<class TYPE >
bsl::Pair_First< TYPE >::Pair_First ( )
inlineprotected

Value-initialize the 'first' member of a 'pair'.

◆ Pair_First() [4/15]

template<class TYPE >
bsl::Pair_First< TYPE >::Pair_First ( BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomNone   
)
inlineprotected

Construct the first member of a pair, using the specified basicAllocator to supply memory.

Note
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.

◆ Pair_First() [5/15]

template<class TYPE >
bsl::Pair_First< TYPE >::Pair_First ( BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomAtEnd   
)
inlineprotected

◆ Pair_First() [6/15]

template<class TYPE >
bsl::Pair_First< TYPE >::Pair_First ( BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomAllocatorArgT   
)
inlineprotected

◆ Pair_First() [7/15]

template<class TYPE >
BSLS_KEYWORD_CONSTEXPR bsl::Pair_First< TYPE >::Pair_First ( typename bsl::add_lvalue_reference< const TYPE >::type  value)
inlineexplicitprotected

Construct the first member from the specified non-modifiable value, without specifying an allocator.

◆ Pair_First() [8/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( const PARAM &  value)
inlineexplicitprotected

Construct the 'first' member of a 'pair' from the specified 'value' without specifying an allocator. This function (perfectly) forwards 'value' to the constructor of (template parameter) 'TYPE'.

Note
Note that this constructor is constrained to avoid accidentally becoming a stronger match for the move and copy constructors.

◆ Pair_First() [9/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( PARAM &  value)
inlineexplicitprotected

◆ Pair_First() [10/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( const PARAM &  value,
BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomNone   
)
inlineprotected

Construct the 'first' member of a 'pair' from the specified 'value', using the specified 'basicAllocator' to supply memory. This function (perfectly) forwards 'value' to the constructor of (template parameter) 'TYPE'.

Note
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, or 2) 'TYPE' takes a 'bslma'-style allocator as the last constructor argument, or 3) 'TYPE' takes a 'bslma'-style allocator as the second constructor argument preceded by 'bsl::allocator_arg'. ..

◆ Pair_First() [11/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( PARAM &  value,
BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomNone   
)
inlineprotected

◆ Pair_First() [12/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( const PARAM &  value,
BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomAtEnd   
)
inlineprotected

◆ Pair_First() [13/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( PARAM &  value,
BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomAtEnd   
)
inlineprotected

◆ Pair_First() [14/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( const PARAM &  value,
BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomAllocatorArgT   
)
inlineprotected

◆ Pair_First() [15/15]

template<class TYPE >
template<class PARAM >
bsl::Pair_First< TYPE >::Pair_First ( PARAM &  value,
BloombergLP::bslma::Allocator *  basicAllocator,
Pair_BslmaIdiomAllocatorArgT   
)
inlineprotected

Member Function Documentation

◆ operator=() [1/2]

template<class TYPE >
Pair_First & bsl::Pair_First< TYPE >::operator= ( const Pair_First< TYPE > &  )
protecteddefault

◆ operator=() [2/2]

template<class TYPE >
Pair_First & bsl::Pair_First< TYPE >::operator= ( Pair_First< TYPE > &&  )
protecteddefault

Member Data Documentation

◆ first

template<class TYPE >
TYPE bsl::Pair_First< TYPE >::first
protected

The documentation for this struct was generated from the following file: