[#bsl-allocator_traits-0ae]
= xref:bsl.adoc[bsl]::xref:bsl/allocator_traits-0108.adoc[allocator&lowbar;traits]&lt;std::allocator&lt;ALLOCATOR&lowbar;TYPE&gt;&gt;
:relfileprefix: ../
:mrdocs:

Specialization of `allocator&lowbar;traits` that uses `std&colon;&colon;allocator&lowbar;traits`&period;

== Synopsis

Declared in `&lt;bslma&lowbar;allocatortraits&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&lowbar;TYPE&gt;
struct xref:bsl/allocator_traits-0108.adoc[allocator&lowbar;traits]&lt;std::allocator&lt;ALLOCATOR&lowbar;TYPE&gt;&gt;;
----

== Description

Since C&plus;&plus;17 many of the `std&colon;&colon;allocator` members are deprecated (and removed in C&plus;&plus;20)&period; C&plus;&plus;23 deprecates type name members and C&plus;&plus;26 removes them&period; The clang compiler on Darwin warns about any mention of those names in C&plus;&plus;17 so this header file was producing many warnings&period; The specialization below &quot;disconnects&quot; the allocator traits of `std&colon;&colon;allocator` from our own implementation and so it avoids not only warnings but possible other hassles as the `std&colon;&colon;allocator` interface is morphing&period;

Note that we are using the standard traits (in place of ours) only on C&plus;&plus;17 or later compilers and not C&plus;&plus;11 (when `std&colon;&colon;allocator&lowbar;traits` appeared)&period; The reason for this is that our `bsl&colon;&colon;allocator&lowbar;traits` supports `allocator&lowbar;traits&colon;&colon;is&lowbar;always&lowbar;equal` from C&plus;&plus;17 in a backwards compatible manner so we cannot use pre&hyphen;C&plus;&plus;17 standard implementation that does not have that&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:bsl/allocator_traits-0ae/rebind_alloc.adoc[`rebind&lowbar;alloc`] 
| Alias template that rebinds the allocator to `ELEMENT&lowbar;TYPE`&period;
| xref:bsl/allocator_traits-0ae/rebind_traits.adoc[`rebind&lowbar;traits`] 
| `allocator&lowbar;traits` for an allocator rebound to `ELEMENT&lowbar;TYPE`&period;
|===


== Using Declarations

[cols="1,4"]
|===
| Name| Description
| xref:bsl/allocator_traits-0ae/allocate.adoc[`allocate`] 
| Allocate uninitialized storage for `n` objects, optionally using `hint`&period;
| xref:bsl/allocator_traits-0ae/allocator_type.adoc[`allocator&lowbar;type`] 
| This `typedef` is an alias to `std&colon;&colon;allocator&lt;ALLOCATOR&lowbar;TYPE&gt;`&period;
| xref:bsl/allocator_traits-0ae/const_pointer.adoc[`const&lowbar;pointer`] 
| This `typedef` is an alias to `allocator&lowbar;type&colon;&colon;const&lowbar;pointer`&period;
| xref:bsl/allocator_traits-0ae/const_void_pointer.adoc[`const&lowbar;void&lowbar;pointer`] 
| This `typedef` is an alias to `allocator&lowbar;type&colon;&colon;const&lowbar;void&lowbar;pointer`&period;
| xref:bsl/allocator_traits-0ae/construct.adoc[`construct`] 
| Construct an object at the specified uninitialized address&period;
| xref:bsl/allocator_traits-0ae/deallocate.adoc[`deallocate`] 
| Deallocate the storage at `p` for `n` objects&period;
| xref:bsl/allocator_traits-0ae/destroy.adoc[`destroy`] 
| Destroy the object at the specified address&period;
| xref:bsl/allocator_traits-0ae/difference_type.adoc[`difference&lowbar;type`] 
| This `typedef` is an alias to `allocator&lowbar;type&colon;&colon;difference&lowbar;type`&period;
| xref:bsl/allocator_traits-0ae/is_always_equal.adoc[`is&lowbar;always&lowbar;equal`] 
| `true&lowbar;type` if two allocators always compare equal&semi; else `false&lowbar;type`&period;
| xref:bsl/allocator_traits-0ae/max_size.adoc[`max&lowbar;size`] 
| Return the maximum number of objects `allocate` can return&period;
| xref:bsl/allocator_traits-0ae/pointer.adoc[`pointer`] 
| This `typedef` is an alias to `allocator&lowbar;type&colon;&colon;pointer`&period;
| xref:bsl/allocator_traits-0ae/propagate_on_container_copy_assignment.adoc[`propagate&lowbar;on&lowbar;container&lowbar;copy&lowbar;assignment`] 
| `true&lowbar;type` if the allocator propagates on copy assignment&period;
| xref:bsl/allocator_traits-0ae/propagate_on_container_move_assignment.adoc[`propagate&lowbar;on&lowbar;container&lowbar;move&lowbar;assignment`] 
| `true&lowbar;type` if the allocator propagates on move assignment&period;
| xref:bsl/allocator_traits-0ae/propagate_on_container_swap.adoc[`propagate&lowbar;on&lowbar;container&lowbar;swap`] 
| `true&lowbar;type` if the allocator propagates on container swap&period;
| xref:bsl/allocator_traits-0ae/select_on_container_copy_construction.adoc[`select&lowbar;on&lowbar;container&lowbar;copy&lowbar;construction`] 
| Return the allocator to use when copy&hyphen;constructing a container&period;
| xref:bsl/allocator_traits-0ae/size_type.adoc[`size&lowbar;type`] 
| This `typedef` is an alias to `allocator&lowbar;type&colon;&colon;size&lowbar;type`&period;
| xref:bsl/allocator_traits-0ae/value_type.adoc[`value&lowbar;type`] 
| This `typedef` is an alias to `allocator&lowbar;type&colon;&colon;value&lowbar;type`&period;
| xref:bsl/allocator_traits-0ae/void_pointer.adoc[`void&lowbar;pointer`] 
| This `typedef` is an alias to `allocator&lowbar;type&colon;&colon;void&lowbar;pointer`&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
