[#bsl-allocator_traits-0ae] = xref:bsl.adoc[bsl]::xref:bsl/allocator_traits-0108.adoc[allocator_traits]<std::allocator<ALLOCATOR_TYPE>> :relfileprefix: ../ :mrdocs: Specialization of `allocator_traits` that uses `std::allocator_traits`. == Synopsis Declared in `<bslma_allocatortraits.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class ALLOCATOR_TYPE> struct xref:bsl/allocator_traits-0108.adoc[allocator_traits]<std::allocator<ALLOCATOR_TYPE>>; ---- == Description Since C++17 many of the `std::allocator` members are deprecated (and removed in C++20). C++23 deprecates type name members and C++26 removes them. The clang compiler on Darwin warns about any mention of those names in C++17 so this header file was producing many warnings. The specialization below "disconnects" the allocator traits of `std::allocator` from our own implementation and so it avoids not only warnings but possible other hassles as the `std::allocator` interface is morphing. Note that we are using the standard traits (in place of ours) only on C++17 or later compilers and not C++11 (when `std::allocator_traits` appeared). The reason for this is that our `bsl::allocator_traits` supports `allocator_traits::is_always_equal` from C++17 in a backwards compatible manner so we cannot use pre‐C++17 standard implementation that does not have that. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/allocator_traits-0ae/rebind_alloc.adoc[`rebind_alloc`] | Alias template that rebinds the allocator to `ELEMENT_TYPE`. | xref:bsl/allocator_traits-0ae/rebind_traits.adoc[`rebind_traits`] | `allocator_traits` for an allocator rebound to `ELEMENT_TYPE`. |=== == Using Declarations [cols="1,4"] |=== | Name| Description | xref:bsl/allocator_traits-0ae/allocate.adoc[`allocate`] | Allocate uninitialized storage for `n` objects, optionally using `hint`. | xref:bsl/allocator_traits-0ae/allocator_type.adoc[`allocator_type`] | This `typedef` is an alias to `std::allocator<ALLOCATOR_TYPE>`. | xref:bsl/allocator_traits-0ae/const_pointer.adoc[`const_pointer`] | This `typedef` is an alias to `allocator_type::const_pointer`. | xref:bsl/allocator_traits-0ae/const_void_pointer.adoc[`const_void_pointer`] | This `typedef` is an alias to `allocator_type::const_void_pointer`. | xref:bsl/allocator_traits-0ae/construct.adoc[`construct`] | Construct an object at the specified uninitialized address. | xref:bsl/allocator_traits-0ae/deallocate.adoc[`deallocate`] | Deallocate the storage at `p` for `n` objects. | xref:bsl/allocator_traits-0ae/destroy.adoc[`destroy`] | Destroy the object at the specified address. | xref:bsl/allocator_traits-0ae/difference_type.adoc[`difference_type`] | This `typedef` is an alias to `allocator_type::difference_type`. | xref:bsl/allocator_traits-0ae/is_always_equal.adoc[`is_always_equal`] | `true_type` if two allocators always compare equal; else `false_type`. | xref:bsl/allocator_traits-0ae/max_size.adoc[`max_size`] | Return the maximum number of objects `allocate` can return. | xref:bsl/allocator_traits-0ae/pointer.adoc[`pointer`] | This `typedef` is an alias to `allocator_type::pointer`. | xref:bsl/allocator_traits-0ae/propagate_on_container_copy_assignment.adoc[`propagate_on_container_copy_assignment`] | `true_type` if the allocator propagates on copy assignment. | xref:bsl/allocator_traits-0ae/propagate_on_container_move_assignment.adoc[`propagate_on_container_move_assignment`] | `true_type` if the allocator propagates on move assignment. | xref:bsl/allocator_traits-0ae/propagate_on_container_swap.adoc[`propagate_on_container_swap`] | `true_type` if the allocator propagates on container swap. | xref:bsl/allocator_traits-0ae/select_on_container_copy_construction.adoc[`select_on_container_copy_construction`] | Return the allocator to use when copy‐constructing a container. | xref:bsl/allocator_traits-0ae/size_type.adoc[`size_type`] | This `typedef` is an alias to `allocator_type::size_type`. | xref:bsl/allocator_traits-0ae/value_type.adoc[`value_type`] | This `typedef` is an alias to `allocator_type::value_type`. | xref:bsl/allocator_traits-0ae/void_pointer.adoc[`void_pointer`] | This `typedef` is an alias to `allocator_type::void_pointer`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#