#include <bslma_aatypeutil.h>
|
template<class TYPE > |
static bsl::enable_if< AAModel< TYPE >::value==AAModelLegacy::value||AAModel< TYPE >::value==AAModelBsl::value, bslma::Allocator * >::type | getAdaptedAllocator (const TYPE &object) |
|
template<class TYPE > |
static bsl::enable_if< AAModel< TYPE >::value!=AAModelLegacy::value &&AAModel< TYPE >::value!=AAModelBsl::value, typenameTYPE::allocator_type >::type | getAdaptedAllocator (const TYPE &object) |
|
template<class ALLOCATOR , class TYPE > |
static bsl::enable_if<(bsl::is_convertible< bslma::Allocator *, ALLOCATOR >::value &&bslma::AAModelIsSupported< TYPE, bslma::AAModelLegacy >::value), ALLOCATOR >::type | getAllocatorFromSubobject (const TYPE &object) |
|
template<class ALLOCATOR , class TYPE > |
static bsl::enable_if<!(bsl::is_convertible< bslma::Allocator *, ALLOCATOR >::value &&bslma::AAModelIsSupported< TYPE, bslma::AAModelLegacy >::value), ALLOCATOR >::type | getAllocatorFromSubobject (const TYPE &object) |
|
template<class TYPE > |
static bsl::enable_if< AAModelIsSupported< TYPE, AAModelLegacy >::value, bsl::allocator< char > >::type | getBslAllocator (const TYPE &object) |
|
template<class TYPE > |
static bsl::enable_if< AAModel< TYPE >::value==AAModelLegacy::value, Allocator * >::type | getNativeAllocator (const TYPE &object) |
|
template<class TYPE > |
static bsl::enable_if< HasAllocatorType< TYPE >::value, typenameTYPE::allocator_type >::type | getNativeAllocator (const TYPE &object) |
|
template<class TYPE > |
static bsl::enable_if< AAModel< TYPE >::value==AAModelNone::value, bool >::type | haveEqualAllocators (const TYPE &a, const TYPE &b) |
|
template<class TYPE > |
static bsl::enable_if< AAModel< TYPE >::value!=AAModelNone::value, bool >::type | haveEqualAllocators (const TYPE &a, const TYPE &b) |
|
Namespace for utility functions on allocator-aware types
See bslma_aatypeutil
◆ getAdaptedAllocator() [1/2]
Return the allocator held by the specified object
, adapted to be usable as a constructor argument for the widest possible set of AA types. This overload will be selected if TYPE
is bsl-AA or legacy-AA.
◆ getAdaptedAllocator() [2/2]
Return the allocator held by the specified object
. This overload will be selected if TYPE
is pmr-AA or stl-AA.
◆ getAllocatorFromSubobject() [1/2]
template<class ALLOCATOR , class TYPE >
Return an object of the explicitly specified ALLOCATOR
type representing the same resource as the allocator for the specified object
. This function can recover allocator type information when an ALLOCATOR
object is used to construct a TYPE
object that holds an allocator type compatible with, but not necessarily directly convertible to, ALLOCATOR
– e.g., when TYPE
is pmr-AA and ALLOCATOR
is bsl::allocator<int>
– in which case this function reverses the implicit conversion from ALLOCATOR
that occured when object
was originally constructed. When TYPE
is stl-AA or ALLOCATOR
is not constructible from 'bsl::Allocator *, this function simply constructs
ALLOCATOR', from object
's allocator, if such an explicit conversion is valid; otherwise the call is ill-formed. The behavior is undefined unless object
was originally constructed with an allocator of type ALLOCATOR
.
◆ getAllocatorFromSubobject() [2/2]
template<class ALLOCATOR , class TYPE >
◆ getBslAllocator()
Return the allocator for the specified object
, converted to bsl::allocator<char>
. This function will not participate in overload resolution unless TYPE
is pmr-AA, bsl-AA, or legacy-AA. In the case of a pmr-AA TYPE
, the behavior is undefined unless object
was originally constructed constructed with an allocator value holding a pointer to a memory_resource
whose dynamic type is derived from bslma::Allocator
.
◆ getNativeAllocator() [1/2]
Return the address of the bslma::Allocator
used by the specified AA object
. This function does not participate in overload resolution unless TYPE
is legacy-AA (i.e., uses bslma::Allocator *
as its allocator vocabulary type). Note that instantiation will fail unless object.allocator()
is well formed and returns a type convertible to bslma::Allocator *
.
◆ getNativeAllocator() [2/2]
template<class TYPE >
static bsl::enable_if< HasAllocatorType< TYPE >::value, typenameTYPE::allocator_type >::type bslma::AATypeUtil::getNativeAllocator |
( |
const TYPE & |
object | ) |
|
|
static |
Return the allocator used by the specified AA object
. This function does not participate in overload resolution unless TYPE
has an allocator_type
member. Note that instantiation will fail unless object.get_allocator()
is well formed and returns a type convertible to TYPE::allocator_type
.
◆ haveEqualAllocators() [1/2]
Return true
if (a) TYPE
is AA and the allocators used by the specified a
and b
compare equal or (b) template parameter TYPE
is not AA; otherwise return false
. Note that if TYPE
is AA, instantiation will fail unless the appropriate allocator accessor is well-formed, i.e. object.allocator()
if TYPE
is legacy-AA and object.get_allocator()
otherwise.
◆ haveEqualAllocators() [2/2]
The documentation for this class was generated from the following file: