[#BloombergLP-bslstl-StringRefImp-02-assign-0a] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/StringRefImp-02.adoc[StringRefImp<char>]::assign :relfileprefix: ../../../ :mrdocs: Bind this string reference to the string at the specified `data` address and extending for the specified `length` characters. The string indicated by `data` and `length` must remain valid as long as it is bound to this object. The behavior is undefined unless `0 <= length` or `0 == data && 0 == length`. Note that the string need not be null‐terminated and may contain embedded null characters. Note that the template and non‐template versions combine to allow various integral and enumeration types to be used for length while preventing `(char *, 0)` initializer arguments from matching the two‐iterator overload of `assign` below. == Synopsis Declared in `<bslstl_stringref.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INT_TYPE> void assign( char const* data, INT_TYPE length) requires bsl::is_integral<INT_TYPE>::value; ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#