[#bsl-basic_string-0faf-2constructor-004]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]::basic&lowbar;string
:relfileprefix: ../../
:mrdocs:

Create a string that has the same value as the specified `original` string and uses the specified `basicAllocator` to supply memory&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
basic&lowbar;string(
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string] const& original,
    ALLOCATOR const& basicAllocator);
----

== Description

Note that it is important to have two copy constructors instead of a single&colon; &grave; basic&lowbar;string(const basic&lowbar;string&amp; original, const ALLOCATOR&amp; basicAllocator &equals; ALLOCATOR())&semi; &grave; When the copy constructor with the default allocator is used, xlC10 gets confused and refuses to use the return value optimization, which then causes extra allocations when returning by value in `operator&plus;`&period;


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