[#bsl-String_ClearProctor]
= xref:bsl.adoc[bsl]::String&lowbar;ClearProctor
:relfileprefix: ../
:mrdocs:

This component private `class` implements a proctor that sets the length of a string to zero, and, if `release` is not called, will restore that string upon it&apos;s destruction&period; The intended usage is to implement `assign` methods in terms of `append` (by clearing the string before appending to it), while maintaining the strong exceptions guarantee&period; Note that after constructing this proctor for a string `s`, the invariant `s&lsqb;s&period;length()&rsqb;&equals;&equals; CHAR&lowbar;TYPE()` is violated for non&hyphen;empty `s`&period; This invariant will be restored by either a successful `append` or by the proctor&apos;s destructor if an exception is thrown&period; Note that the template parameter was renamed from STRING&lowbar;TYPE to FULL&lowbar;STRING&lowbar;TYPE due to a name clash with a define elsewhere in the code base (see DRQS 112049582)&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;string&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FULL&lowbar;STRING&lowbar;TYPE&gt;
class String&lowbar;ClearProctor;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/String_ClearProctor/2constructor.adoc[`String&lowbar;ClearProctor`]         [.small]#[constructor]#
| Create a `String&lowbar;ClearProctor` for the specified `stringPtr`, and set both the length of `stringPtr` to 0 and the first character of `stringPtr` to `CHAR&lowbar;TYPE()`&period;
| xref:bsl/String_ClearProctor/2destructor.adoc[`&#126;String&lowbar;ClearProctor`] [.small]#[destructor]#
| Destroy this object, and if `release` has not been called, restore the original state of the string supplied at construction&period;
| xref:bsl/String_ClearProctor/release.adoc[`release`] 
| Release the proctor indicating that the string state need not to be restored&period;
|===



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