[#BloombergLP-bslma-AllocatorUtil-swap-075bea]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/AllocatorUtil.adoc[AllocatorUtil]::swap
:relfileprefix: ../../../
:mrdocs:

If the specified `allowed` tag is `bsl&colon;&colon;true&lowbar;type`, swap the values of allocators at the specified `pa` and `pb` addresses using ADL swap (with `std&colon;&colon;swap` in scope)&semi; otherwise, do nothing&period; The `t&lowbar;TYPE` template parameter is typically an allocator type and the `allowed` flag is typically a propagation trait dependant on the calling context, such as `propagate&lowbar;on&lowbar;container&lowbar;swap`&period; Instantiation will fail if `allowed` is `false&lowbar;type` and `t&lowbar;TYPE` is not swappable (i&period;e&period;, because it lacks a publically available assignment operator)&period; The behavior is undefined unless `allowed` is `true&lowbar;type` or &apos;&ast;pa &equals;&equals; &ast;pb&apos; before the call&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;TYPE&gt;
static
void
swap(
    t&lowbar;TYPE* pa,
    t&lowbar;TYPE* pb,
    xref:bsl/false_type.adoc[bsl::false&lowbar;type] allowed);
----


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