Quick Links:

bal | bbl | bdl | bsl

Classes | Public Types | Static Public Member Functions

bsl::allocator_traits< ALLOCATOR_TYPE > Struct Template Reference

#include <bslma_allocatortraits.h>

List of all members.

Classes

struct  rebind_alloc
struct  rebind_traits

Public Types

typedef ALLOCATOR_TYPE allocator_type
typedef ALLOCATOR_TYPE::value_type value_type
typedef
BloombergLP::bslma::AllocatorTraits_PointerType
< ALLOCATOR_TYPE >::type 
pointer
typedef
BloombergLP::bslma::AllocatorTraits_ConstPointerType
< ALLOCATOR_TYPE >::type 
const_pointer
typedef
BloombergLP::bslma::AllocatorTraits_VoidPointerType
< ALLOCATOR_TYPE >::type 
void_pointer
typedef
BloombergLP::bslma::AllocatorTraits_ConstVoidPointerType
< ALLOCATOR_TYPE >::type 
const_void_pointer
typedef
BloombergLP::bslma::AllocatorTraits_DifferenceType
< ALLOCATOR_TYPE >::type 
difference_type
typedef
BloombergLP::bslma::AllocatorTraits_SizeType
< ALLOCATOR_TYPE >::type 
size_type
typedef
BloombergLP::bslma::AllocatorTraits_IsAlwaysEqual
< ALLOCATOR_TYPE >::type 
is_always_equal
typedef
BloombergLP::bslma::AllocatorTraits_PropOnCopyAssign
< ALLOCATOR_TYPE >::type 
propagate_on_container_copy_assignment
typedef
BloombergLP::bslma::AllocatorTraits_PropOnMoveAssign
< ALLOCATOR_TYPE >::type 
propagate_on_container_move_assignment
typedef
BloombergLP::bslma::AllocatorTraits_PropOnSwap
< ALLOCATOR_TYPE >::type 
propagate_on_container_swap

Static Public Member Functions

static pointer allocate (ALLOCATOR_TYPE &basicAllocator, size_type n)
static pointer allocate (ALLOCATOR_TYPE &basicAllocator, size_type n, const_void_pointer hint)
static void deallocate (ALLOCATOR_TYPE &basicAllocator, pointer elementAddr, size_type n)
template<class ELEMENT_TYPE , class... Args>
static void construct (ALLOCATOR_TYPE &basicAllocator, ELEMENT_TYPE *elementAddr, Args &&...arguments)
template<class ELEMENT_TYPE >
static void destroy (ALLOCATOR_TYPE &basicAllocator, ELEMENT_TYPE *elementAddr)
static size_type max_size (const ALLOCATOR_TYPE &basicAllocator) BSLS_KEYWORD_NOEXCEPT
static ALLOCATOR_TYPE select_on_container_copy_construction (const ALLOCATOR_TYPE &rhs)

Detailed Description

template<class ALLOCATOR_TYPE>
struct bsl::allocator_traits< ALLOCATOR_TYPE >

This class supports the complete interface of the C++11 allocator_traits class template, which provides a uniform mechanism for accessing nested types within, and operations on, any standard-conforming allocator. A specialization of this class template for bsl::allocator provides support for Bloomberg's bslma allocator model (see the bslma_stdallocator component for more details). In C++11 compilation environments, the construct methods forward to the allocator's construct method if such a method matching the (variable number of) specified constructor arguments exists; otherwise, the construct method falls back to invoking the constructor of the element type directly. In C++03 compilation environments, there is no reliable way to detect if the type provide a method that matches a (variable number of) specified arguments; therefore, we require that standard allocator types define construct methods taking a variable number of arguments in those environments. This implementation is not fully-standard-conforming in that it does not support deduce data types that are not specified in the allocator.

See Component bslma_allocatortraits


Member Typedef Documentation

template<class ALLOCATOR_TYPE>
typedef ALLOCATOR_TYPE bsl::allocator_traits< ALLOCATOR_TYPE >::allocator_type
template<class ALLOCATOR_TYPE>
typedef ALLOCATOR_TYPE::value_type bsl::allocator_traits< ALLOCATOR_TYPE >::value_type
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_PointerType<ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::pointer
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_ConstPointerType<ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::const_pointer
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_VoidPointerType<ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::void_pointer
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma:: AllocatorTraits_ConstVoidPointerType<ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::const_void_pointer
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_DifferenceType<ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::difference_type
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_SizeType<ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::size_type
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_IsAlwaysEqual< ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::is_always_equal
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_PropOnCopyAssign< ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::propagate_on_container_copy_assignment
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_PropOnMoveAssign< ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::propagate_on_container_move_assignment
template<class ALLOCATOR_TYPE>
typedef BloombergLP::bslma::AllocatorTraits_PropOnSwap< ALLOCATOR_TYPE>::type bsl::allocator_traits< ALLOCATOR_TYPE >::propagate_on_container_swap

Member Function Documentation

template<class ALLOCATOR_TYPE>
static pointer bsl::allocator_traits< ALLOCATOR_TYPE >::allocate ( ALLOCATOR_TYPE &  basicAllocator,
size_type  n 
) [static]

Return basicAllocator.allocate(n).

template<class ALLOCATOR_TYPE>
static pointer bsl::allocator_traits< ALLOCATOR_TYPE >::allocate ( ALLOCATOR_TYPE &  basicAllocator,
size_type  n,
const_void_pointer  hint 
) [static]

Return basicAllocator.allocate(n, hint).

template<class ALLOCATOR_TYPE>
static void bsl::allocator_traits< ALLOCATOR_TYPE >::deallocate ( ALLOCATOR_TYPE &  basicAllocator,
pointer  elementAddr,
size_type  n 
) [static]

Invoke basicAllocator.deallocate(elementAddr, n). The behavior is undefined unless the specified elementAddr was returned from a prior call to the allocate method of an allocator that compares equal to the specified allocator, and has not yet been passed to a deallocate call of such an allocator object.

template<class ALLOCATOR_TYPE>
template<class ELEMENT_TYPE , class... Args>
static void bsl::allocator_traits< ALLOCATOR_TYPE >::construct ( ALLOCATOR_TYPE &  basicAllocator,
ELEMENT_TYPE *  elementAddr,
Args &&...  arguments 
) [static]

Construct an object of (template parameter) type ELEMENT_TYPE at the specified elementAddr, either by 1) calling the construct method on basicAllocator with elemAddr and the specified (variable number of) arguments if the (template parameter) type ALLOCATOR_TYPE defines such a method, or 2) forwarding the specified (variable number of) arguments to the constructor of ELEMENT_TYPE directly (and ignoring basicAllocator) otherwise. The behavior is undefined unless elementAddr refers to valid, uninitialized storage.

template<class ALLOCATOR_TYPE>
template<class ELEMENT_TYPE >
static void bsl::allocator_traits< ALLOCATOR_TYPE >::destroy ( ALLOCATOR_TYPE &  basicAllocator,
ELEMENT_TYPE *  elementAddr 
) [static]

Destroy the object of (template parameter) type ELEMENT_TYPE at the specified elementAddr, either by 1) calling the destroy method on basicAllocator with elemAddr as the sole argument if the (template parameter) type ALLOCATOR_TYPE defines such a method, or 2) calling the destructor directly on elementAddr (and ignoring basicAllocator) otherwise. The behavior is undefined unless elementAddr refers to a valid, constructed object.

template<class ALLOCATOR_TYPE>
static size_type bsl::allocator_traits< ALLOCATOR_TYPE >::max_size ( const ALLOCATOR_TYPE &  basicAllocator  )  [static]

Return the largest number of value_type objects that could reasonably be returned by a single invocation of allocate for the specified allocator, i.e., allocator.max_size().

template<class ALLOCATOR_TYPE>
static ALLOCATOR_TYPE bsl::allocator_traits< ALLOCATOR_TYPE >::select_on_container_copy_construction ( const ALLOCATOR_TYPE &  rhs  )  [static]

Return a copy of the allocator that should be used to copy- construct one container from another container whose allocator is the specified rhs. If the parameterized ALLOCATOR_TYPE defines a method select_on_container_copy_construction, this function returns the result of calling that method on rhs; otherwise, this method enforces the default policy of propagating the allocator on copy construction, as is standard practice for standard allocators (i.e., returns rhs). Note that the specialization of this class template for bsl::allocator (in the bslma_stdallocator component) provides the alternate default behavior of not propagating the allocator on copy construction (i.e., returning a default-constructed allocator object).


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