[#BloombergLP-bslstl-StringRefImp-02-2constructor-00]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/StringRefImp-02.adoc[StringRefImp&lt;char&gt;]::StringRefImp
:relfileprefix: ../../../
:mrdocs:

Constructors

== Synopses

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

Create an object representing an empty `std&colon;&colon;string` value that is independent of any external representation and with the following attribute values&colon; &grave; begin() &equals;&equals; end() isEmpty() &equals;&equals; true &grave;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0b.adoc[StringRefImp]();
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0b.adoc[_» more&period;&period;&period;_]#

Create a string ref referencing the specified `bsl&colon;&colon;basic&lowbar;string`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-081.adoc[StringRefImp](xref:bsl/basic_string-0faf.adoc[bsl::basic&lowbar;string&lt;char&gt;] const& str);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-081.adoc[_» more&period;&period;&period;_]#

Create a string ref referencing the specified `std&colon;&colon;pmr&colon;&colon;basic&lowbar;string`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-06.adoc[StringRefImp](std::pmr::basic&lowbar;string&lt;char&gt; const& str);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-06.adoc[_» more&period;&period;&period;_]#

Create a string ref referencing the specified `std&colon;&colon;basic&lowbar;string`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-08d.adoc[StringRefImp](std::basic&lowbar;string&lt;char&gt; const& str);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-08d.adoc[_» more&period;&period;&period;_]#

Create a string&hyphen;reference object having a valid `std&colon;&colon;string` value, whose external representation is defined by the specified `str` object&period; The external representation must remain valid as long as it is bound to this string reference&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-04.adoc[StringRefImp](bsl::basic&lowbar;string&lowbar;view&lt;char&gt; const& str);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-04.adoc[_» more&period;&period;&period;_]#

Create a string&hyphen;reference object having a valid `std&colon;&colon;string` value, whose external representation begins at the specified `data` address and extends for `std&colon;&colon;char&lowbar;traits&lt;CHAR&lowbar;TYPE&gt;&colon;&colon;length(data)` characters&period; The external representation must remain valid as long as it is bound to this string reference&period; The behavior is undefined unless `data` is null&hyphen;terminated&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0c.adoc[StringRefImp](char const* data);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0c.adoc[_» more&period;&period;&period;_]#

Create a string&hyphen;reference object having a valid `std&colon;&colon;string` value, whose external representation begins at the specified `begin` iterator and extends up to, but not including, the specified `end` iterator&period; The external representation must remain valid as long as it is bound to this string reference&period; The behavior is undefined unless `begin &lt;&equals; end`&period; Note that, like an `std&colon;&colon;string`, the string need not be null&hyphen;terminated and may contain embedded null characters&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-01.adoc[StringRefImp](
    xref:BloombergLP/bslstl/StringRefImp-02/const_iterator.adoc[const&lowbar;iterator] begin,
    xref:BloombergLP/bslstl/StringRefImp-02/const_iterator.adoc[const&lowbar;iterator] end);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-01.adoc[_» more&period;&period;&period;_]#

Create a string&hyphen;reference object having a valid `std&colon;&colon;string` value, whose external representation begins at the specified `data` address and extends for the specified `length` characters&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0de.adoc[StringRefImp](
    char const* data,
    xref:BloombergLP/bslstl/StringRefImp-0c/size_type.adoc[size&lowbar;type] length);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0de.adoc[_» more&period;&period;&period;_]#

Create a string&hyphen;reference object having a valid `std&colon;&colon;string` value, whose external representation begins at the specified `data` address and extends for the specified `length`&period; The external representation must remain valid as long as it is bound to this string reference&period; Passing 0 has the same effect as default construction&period; The behavior is undefined unless `0 &lt;&equals; length` and, if `0 &equals;&equals; data`, then `0 &equals;&equals; length`&period; Note that, like an `std&colon;&colon;string`, the `data` 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 constructor below&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INT&lowbar;TYPE&gt;
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-07.adoc[StringRefImp](
    char const* data,
    INT&lowbar;TYPE length)
requires bsl&colon;&colon;is&lowbar;integral&lt;INT&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-07.adoc[_» more&period;&period;&period;_]#

Create a string&hyphen;reference object having a valid `std&colon;&colon;string` value, whose external representation begins at the specified `startIndex` in the specified `original` string reference, and extends either the specified `numCharacters` or until the end of the `original` string reference, whichever comes first&period; The external representation must remain valid as long as it is bound to this string reference&period; The behavior is undefined unless `startIndex &lt;&equals; original&period;length()`&period; Note that if `startIndex` is `original&period;length()` an empty string reference is returned&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0da.adoc[StringRefImp](
    xref:BloombergLP/bslstl/StringRefImp-0c.adoc[StringRefImp&lt;char&gt;] const& original,
    xref:BloombergLP/bslstl/StringRefImp-0c/size_type.adoc[size&lowbar;type] startIndex,
    xref:BloombergLP/bslstl/StringRefImp-0c/size_type.adoc[size&lowbar;type] numCharacters);
----

[.small]#xref:BloombergLP/bslstl/StringRefImp-02/2constructor-0da.adoc[_» more&period;&period;&period;_]#


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