[#BloombergLP-bslma-AllocatorUtil-swap-075bea] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/AllocatorUtil.adoc[AllocatorUtil]::swap :relfileprefix: ../../../ :mrdocs: Conditionally swap the values at `pa` and `pb` based on `allowed`. == Synopsis Declared in `<bslma_allocatorutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_TYPE> static void swap( t_TYPE* pa, t_TYPE* pb, xref:bsl/false_type.adoc[bsl::false_type] allowed); ---- == Description If the specified `allowed` tag is `bsl::true_type`, swap the values of allocators at the specified `pa` and `pb` addresses using ADL swap (with `std::swap` in scope); otherwise, do nothing. The `t_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_on_container_swap`. Instantiation will fail if `allowed` is `false_type` and `t_TYPE` is not swappable (i.e., because it lacks a publically available assignment operator). The behavior is undefined unless `allowed` is `true_type` or '*pa == *pb' before the call. == Parameters [cols="1,4"] |=== | Name| Description | *pa* | address of the first object to swap | *pb* | address of the second object to swap | *allowed* | whether swapping is permitted |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#