[#bsl-basic_string-0e-2constructor-0b]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0e.adoc[basic&lowbar;string&lt;wchar&lowbar;t&gt;]::basic&lowbar;string
:relfileprefix: ../../
:mrdocs:

Create a string that has the same value as the substring of the specified `numChars` length starting at the specified `position` in the specified `object`&period; Optionally specify a `basicAllocator` used to supply memory&period; If the `basicAllocator` is not specified, a default&hyphen;constructed allocator is used&period; Throw `out&lowbar;of&lowbar;range` if `position &gt; original&period;object()`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE&gt;
basic&lowbar;string(
    STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE const& object,
    xref:bsl/basic_string-0e/size_type.adoc[size&lowbar;type] position,
    xref:bsl/basic_string-0e/size_type.adoc[size&lowbar;type] numChars,
    xref:bsl/allocator-0df.adoc[allocator&lt;wchar&lowbar;t&gt;] const& basicAllocator = ALLOCATOR());
----


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