Uniform interface to nested types and operations of any allocator.
Declared in <bslma_allocatortraits.h>
template<class ALLOCATOR_TYPE>
struct allocator_traits;
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_bslallocator 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.
| Name | Description |
|---|---|
allocator_type | This typedef is an alias to the (template parameter) ALLOCATOR_TYPE. |
const_pointer | This typedef is an alias to AllocatorTraits_ConstPointerType<ALLOCATOR_TYPE>::type. |
const_void_pointer | Const void pointer type for the allocator. |
difference_type | This typedef is an alias to AllocatorTraits_DifferenceType<ALLOCATOR_TYPE>::type. |
is_always_equal | true_type if two allocators always compare equal; else false_type. |
pointer | This typedef is an alias to AllocatorTraits_PointerType<ALLOCATOR_TYPE>::type. |
propagate_on_container_copy_assignment | true_type if the allocator propagates on copy assignment. |
propagate_on_container_move_assignment | true_type if the allocator propagates on move assignment. |
propagate_on_container_swap | true_type if the allocator propagates on container swap. |
rebind_alloc | Rebind this allocator to the specified ELEMENT_TYPE. |
rebind_traits | Rebind this allocator traits type to the specified ELEMENT_TYPE. |
size_type | This typedef is an alias to AllocatorTraits_SizeType<ALLOCATOR_TYPE>::type. |
value_type | This typedef is an alias to ALLOCATOR_TYPE::value_type. |
void_pointer | This typedef is an alias to AllocatorTraits_VoidPointerType<ALLOCATOR_TYPE>::type. |
| Name | Description |
|---|---|
allocate | allocate overloads |
construct | Construct an ELEMENT_TYPE object at elementAddr. |
deallocate | Deallocate the storage at elementAddr for n objects. |
destroy | Destroy the ELEMENT_TYPE object at elementAddr. |
max_size | Return the maximum number of objects allocate can return. |
select_on_container_copy_construction | Return the allocator to use when copy-constructing a container. |
| Name | Description |
|---|---|
allocator_traits<allocator<TYPE>> | Specialization of allocator_traits for bsl::allocator. |
allocator_traits<std::allocator<ALLOCATOR_TYPE>> | Specialization of allocator_traits that uses std::allocator_traits. |
allocator_traits<ALLOCATOR_TYPE*> | Empty specialization of allocator_traits for pointer allocator types. |
| Name | Description |
|---|---|
AllocatorUtil_Traits<t_MEMORY_RSRC*, t_TYPE> | Traits for an allocator expressed as a pointer to a memory resource. |