[#BloombergLP-bslstl-StringRefImp-02-assign-0a]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/StringRefImp-02.adoc[StringRefImp&lt;char&gt;]::assign
:relfileprefix: ../../../
:mrdocs:

Bind this string reference to the string at the specified `data` address and extending for the specified `length` characters&period; The string indicated by `data` and `length` must remain valid as long as it is bound to this object&period; The behavior is undefined unless `0 &lt;&equals; length` or `0 &equals;&equals; data &amp;&amp; 0 &equals;&equals; length`&period; Note that the string need not be null&hyphen;terminated and may contain embedded null characters&period; Note that the template and non&hyphen;template versions combine to allow various integral and enumeration types to be used for length while preventing `(char &ast;, 0)` initializer arguments from matching the two&hyphen;iterator overload of `assign` below&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INT&lowbar;TYPE&gt;
void
assign(
    char const* data,
    INT&lowbar;TYPE length)
requires bsl&colon;&colon;is&lowbar;integral&lt;INT&lowbar;TYPE&gt;&colon;&colon;value;
----


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