|
| | BSLMF_NESTED_TRAIT_DECLARATION (allocator, BloombergLP::bslmf::IsBitwiseCopyable) |
| |
| | BSLMF_NESTED_TRAIT_DECLARATION (allocator, BloombergLP::bslmf::IsBitwiseEqualityComparable) |
| |
| | allocator () |
| |
| | allocator (BloombergLP::bslma::Allocator *mechanism) |
| |
| | allocator (const allocator &original) BSLS_KEYWORD_NOEXCEPT |
| |
| template<class ANY_TYPE > |
| | allocator (const allocator< ANY_TYPE > &original) BSLS_KEYWORD_NOEXCEPT |
| |
| | ~allocator ()=default |
| |
| BSLMA_BSLALLOCATOR_DEPRECATE_ASSIGN allocator & | operator= (const allocator &rhs) |
| |
| BSLS_ANNOTATION_NODISCARD pointer | allocate (size_type n, const void *hint=0) |
| |
| void | deallocate (TYPE *p, std::size_t n=1) |
| |
| template<class ELEMENT_TYPE > |
| void | construct (ELEMENT_TYPE *address) |
| |
| template<class ELEMENT_TYPE , class ARG1 , class... ARGS> |
| void | construct (ELEMENT_TYPE *address, ARG1 &argument1, ARGS &&... arguments) |
| |
| template<class ELEMENT_TYPE , class ARG1 , class... ARGS> |
| void | construct (ELEMENT_TYPE *address, BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) argument1, ARGS &&... arguments) |
| |
| template<class ELEMENT_TYPE > |
| void | destroy (ELEMENT_TYPE *address) |
| |
| pointer | address (reference x) const |
| |
| const_pointer | address (const_reference x) const |
| |
| BSLS_KEYWORD_CONSTEXPR size_type | max_size () const |
| |
| BloombergLP::bslma::Allocator * | mechanism () const |
| |
| allocator | select_on_container_copy_construction () const |
| | Return a default-constructed allocator.
|
| |
| | polymorphic_allocator () BSLS_KEYWORD_NOEXCEPT |
| |
| | polymorphic_allocator (memory_resource *r) |
| |
| | polymorphic_allocator (const polymorphic_allocator &original) BSLS_KEYWORD_NOEXCEPT |
| |
| template<class ANY_TYPE > |
| | polymorphic_allocator (const polymorphic_allocator< ANY_TYPE > &original) BSLS_KEYWORD_NOEXCEPT |
| |
| | ~polymorphic_allocator ()=default |
| |
| BSLS_ANNOTATION_NODISCARD TYPE * | allocate (std::size_t n) |
| |
| void | deallocate (TYPE *p, std::size_t n) |
| |
| template<class ELEMENT_TYPE > |
| void | construct (ELEMENT_TYPE *address) |
| |
| template<class ELEMENT_TYPE , class ARG1 , class... ARGS> |
| void | construct (ELEMENT_TYPE *address, ARG1 &argument1, ARGS &&... arguments) |
| |
| template<class ELEMENT_TYPE , class ARG1 , class... ARGS> |
| void | construct (ELEMENT_TYPE *address, BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) argument1, ARGS &&... arguments) |
| |
| template<class ELEMENT_TYPE > |
| void | destroy (ELEMENT_TYPE *address) |
| |
| pointer | address (reference x) const |
| |
| const_pointer | address (const_reference x) const |
| |
| BSLS_KEYWORD_CONSTEXPR size_type | max_size () const |
| |
| memory_resource * | resource () const |
| | Return the address of the memory resource supplied on construction.
|
| |
| polymorphic_allocator | select_on_container_copy_construction () const |
| | Return a default-constructed polymorphic_allocator.
|
| |
template<class TYPE = polymorphic_allocator<>::value_type>
class bsl::allocator< TYPE >
An STL-compatible allocator that forwards allocation calls to an underlying mechanism object of a type derived from bslma::Allocator. This class template adheres to the allocator requirements defined in section [allocator.requirements] and implements a superset of the std::pmr::polymorphic_allocator class template described in section [mem.poly.allocator.class] of the C++ standard and may be used to instantiate any [container] class template that follows the STL allocator protocol. The allocation mechanism is chosen at run-time, giving the programmer run-time control over how a container allocates and frees memory.
See bslma_bslallocator
template<class TYPE >
template<class ELEMENT_TYPE , class ARG1 , class... ARGS>
| void bsl::allocator< TYPE >::construct |
( |
ELEMENT_TYPE * |
address, |
|
|
ARG1 & |
argument1, |
|
|
ARGS &&... |
arguments |
|
) |
| |
|
inline |
Create an object of (template parameter) ELEMENT_TYPE at the specified address, constructed by forwarding the specified argument1 and the (variable number of) additional specified arguments to the corresponding constructor of ELEMENT_TYPE. If ELEMENT_TYPE supports bslma-style allocation, this allocator passes itself to the constructor. If the constructor throws, the memory at address is left in an unspecified state. Note that, in C++03, perfect forwarding is limited such that any lvalue reference in the arguments parameter pack is const-qualified when forwarded to the ELEMENT_TYPE constructor; only argument1 can be forwarded as an unqualified lvalue. The behavior is undefined unless address refers to a block of sufficient size and properly aligned for objects of ELEMENT_TYPE.
DEPRECATED bsl::allocator should not be assigned. Modify this allocator to use the same mechanism as the specified rhs allocator and return a modifiable reference to this object. Note that bsl::allocator objects should never be assigned at runtime, but, in the absence of if constexpr, such assignments can sometimes be found legitimately in dead branches (branches that are never taken at runtime) within function templates; ideally, such code would be replaced by more sophisticated metaprogramming that avoided calls to this operator entirely. Invoking this assignment will result in a review error unless rhs == *this, i.e., when the assignment would be a no-op. In the future, the review error may be replaced with an a hard assertion failure.