[#BloombergLP-bslma-AutoRawDeleter]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::AutoRawDeleter
:relfileprefix: ../../
:mrdocs:

This class implements a range proctor that, unless its `release` method has previously been invoked, automatically deletes the contiguous sequence of managed objects upon destruction by iterating on each (managed) object, first invoking the object&apos;s destructor, and then free memory by invoking the `deallocate` method of an allocator (or pool) of parameterized `ALLOCATOR` type supplied to it at construction&period; The sequence of managed objects of parameterized `TYPE` must have been created using memory provided by this allocator (or pool), which must remain valid throughout the lifetime of this range proctor&period; Note that when the length of this object is non&hyphen;zero, it must refer to a non&hyphen;null array of objects&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TYPE,
    class ALLOCATOR&gt;
class AutoRawDeleter;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/AutoRawDeleter/2constructor.adoc[`AutoRawDeleter`]         [.small]#[constructor]#
| Create an auto raw deleter to manage an array of objects at the specified `origin`, and that uses the specified `allocator` to delete the sequence of objects managed by this range proctor (if not released &hyphen;&hyphen; see `release`) upon destruction&period; Optionally specify `length` to define its range, which by default is empty (i&period;e&period;, `length &equals; 0`)&period; The sequence of objects may extend in either direction from `origin`&period; A positive `length` represents the sequence of objects starting at `origin` and extending &quot;up&quot; to `length` (_not_ including the object at the index position `origin &plus; length`)&period; A negative `length` represents the sequence of objects starting at one position below `origin` and extending &quot;down&quot; to the absolute value of `length` (including the object at index position `origin &plus; length`)&period; If `length` is 0, then this range proctor manages no objects&period; If `origin` is non&hyphen;zero, all objects within the proctored range (if any) must be constructed using memory supplied by `allocator`&period; The behavior is undefined unless `allocator` is non&hyphen;zero, and, if `origin` is 0, &apos;length is also 0&period; Note that when `length` is non&hyphen;positive, the object at the origin is _not_ managed by this range proctor&period; For example, if `origin` is at the index position 2, a `length` of 2 signifies that the objects at positions 2 and 3 are managed, whereas a `length` of &hyphen;2 signifies that the objects at positions 0 and 1 are managed&colon; &grave; length &equals; &hyphen;2 length &equals; 2 &verbar;&lt;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&gt;&verbar; &verbar;&lt;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&gt;&verbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &lowbar;&lowbar;&lowbar; &verbar; 0 &verbar; 1 &verbar; 2 &verbar; 3 &verbar; 4 &verbar; &verbar; 0 &verbar; 1 &verbar; 2 &verbar; 3 &verbar; 4 &verbar; `#&equals;&circ;#&equals;^&equals;&equals;&equals;^#&equals;&circ;#&equals;&apos; `#&equals;&circ;#&equals;^&equals;&equals;&equals;^#&equals;&circ;#&equals;&apos; &circ;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen; origin &circ;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen; origin &grave;
| xref:BloombergLP/bslma/AutoRawDeleter/2destructor.adoc[`&#126;AutoRawDeleter`] [.small]#[destructor]#
| Destroy this range proctor and delete the contiguous sequence of objects it manages (if any) by iterating over each (managed) object, first invoking the object&apos;s destructor, and then freeing memory by invoking the `deallocate` method of the allocator (or pool) that was supplied with the sequence of (managed) objects at construction&period; Note that the order in which the managed objects are deleted is undefined&period;
| xref:BloombergLP/bslma/AutoRawDeleter/length.adoc[`length`] 
| Return the (signed) length of the sequence of objects managed by this range proctor&period;
| xref:BloombergLP/bslma/AutoRawDeleter/operator_inc.adoc[`operator&plus;&plus;`] 
| Increase by one the (signed) length of the sequence of objects managed by this range proctor&period; The behavior is undefined unless the origin of the sequence of objects managed by this proctor is non&hyphen;zero&period; The behavior is undefined unless the origin or this range proctor is non&hyphen;zero&period; Note that if the length of this proctor is currently negative, the number of managed objects will decrease by one, whereas if the length is non&hyphen;negative, the number of managed objects will increase by one&period;
| xref:BloombergLP/bslma/AutoRawDeleter/operator_dec.adoc[`operator&hyphen;&hyphen;`] 
| Decrease by one the (signed) length of the sequence of objects managed by this range proctor&period; The behavior is undefined unless the origin of the sequence of objects managed by this proctor is non&hyphen;zero&period; The behavior is undefined unless the origin or this range proctor is non&hyphen;zero&period; Note that if the length of this proctor is currently positive, the number of managed objects will decrease by one, whereas if the length is non&hyphen;positive, the number of managed objects will increase by one&period;
| xref:BloombergLP/bslma/AutoRawDeleter/release.adoc[`release`] 
| Release from management the sequence of objects currently managed by this range proctor by setting the length of the managed sequence to 0&period; All objects currently under management will become unmanaged (i&period;e&period;, when the proctor goes out of scope and it was not assigned another sequence of objects to manage by invoking `reset`, no objects will be deleted)&period; If no objects are currently being managed, this method has no effect&period; Note that the origin is not affected&period;
| xref:BloombergLP/bslma/AutoRawDeleter/reset.adoc[`reset`] 
| Set the specified `origin` as the origin of the sequence of objects to be managed by this range proctor&period; The behavior is undefined unless `origin` is non&hyphen;zero&period; Note that the length of the sequence of objects managed by this proctor is not affected, and `setLength` should be invoked if the managed range is different from the previously managed sequence of objects&period; Also note that this method releases any previously&hyphen;managed objects from management (without deleting them), and so may be called with or without having called `release` when reusing this object&period;
| xref:BloombergLP/bslma/AutoRawDeleter/setLength.adoc[`setLength`] 
| Set the (signed) length of the sequence of objects managed by this range proctor to the specified `length`&period; The behavior is undefined unless the origin of this range proctor is non&hyphen;zero&period;
|===



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