[#BloombergLP-bslalg-AutoArrayMoveDestructor]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::AutoArrayMoveDestructor
:relfileprefix: ../../
:mrdocs:

This `class` provides a specialized proctor object that, upon destruction and unless the `release` method has been called, bit&hyphen;wise moves the elements in a segment of an array of parameterized `OBJECT&lowbar;TYPE` back to some destination, and destroys some other elements in an adjacent segment of the same array&period; The elements destroyed are delimited by the range `&lsqb; begin(), middle() )&rsqb;` and those moved to `destination()` and in the range `&lsqb; middle(), end() )&rsqb;`&period; Note that, once constructed, `begin()` and `end()` remain fixed&period; As the guard advances, `middle()` and `destination()` move, reflecting the successful transfer of data between the moving range and the destination&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;autoarraymovedestructor&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class OBJECT&lowbar;TYPE,
    class ALLOCATOR = xref:bsl/allocator-0df.adoc[bsl::allocator&lt;OBJECT&lowbar;TYPE&gt;]&gt;
class AutoArrayMoveDestructor;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor/2constructor.adoc[`AutoArrayMoveDestructor`]         [.small]#[constructor]#
| TBD&colon; document the `allocator` parameter&period; Create a proctor for the sequence of elements of the parameterized `OBJECT&lowbar;TYPE` in the specified range `&lsqb; begin, end )&rsqb;` which, upon destruction, moves the range `&lsqb; begin, middle )&rsqb;` to the specified `destination` and destroys the `&lsqb; middle, end )&rsqb;` range&period; The behavior is undefined unless `begin`, `middle`, and `end` refer to a contiguous sequence of initialized `OBJECT&lowbar;TYPE` objects, where `begin &lt;&equals; middle &lt;&equals; end`, and `destination` refers to a contiguous sequence of (uninitialized) memory of sufficient size to hold `end &hyphen; begin` `OBJECT&lowbar;TYPE` objects (which must not overlap `&lsqb;begin, end)&rsqb;`)&period;
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor/2destructor.adoc[`&#126;AutoArrayMoveDestructor`] [.small]#[destructor]#
| Bit&hyphen;wise move the range `&lsqb; middle(), end() )&rsqb;` to the `destination()` address and destroy `&lsqb; begin(), middle() )&rsqb;`&period;
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor/advance.adoc[`advance`] 
| Increment both middle and destination pointers by one position&period; The behavior is undefined if this operation result in `destination()` entering the `&lsqb; begin(), end() )&rsqb;` range&period;
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor/begin.adoc[`begin`] 
| Return the address at the beginning of the guarded range&period;
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor/destination.adoc[`destination`] 
| Return the destination address, to which the second portion of the guarded range, delimited by `&lsqb; middle(), end() )&rsqb;`, will be moved upon destruction, or 0 if this guard has been released&period;
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor/end.adoc[`end`] 
| Return the address at the end of the guarded range&period;
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor/middle.adoc[`middle`] 
| Return the address at the middle of the guarded range&period;
|===



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