[#bsl-vector-00d-2constructor-037]
= xref:bsl.adoc[bsl]::xref:bsl/vector-00d.adoc[vector]::vector
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

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

Create an empty vector&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/2constructor-0c87.adoc[vector]() noexcept;
----

[.small]#xref:bsl/vector-00d/2constructor-0c87.adoc[_» more&period;&period;&period;_]#

Copy&hyphen;construct a vector from `original`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/2constructor-01b.adoc[vector](xref:bsl/vector-00d.adoc[vector] const& original);
----

[.small]#xref:bsl/vector-00d/2constructor-01b.adoc[_» more&period;&period;&period;_]#

Create a vector by moving from the specified `original`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/2constructor-05d.adoc[vector](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;vector&gt;] original) noexcept;
----

[.small]#xref:bsl/vector-00d/2constructor-05d.adoc[_» more&period;&period;&period;_]#

Create an empty vector that uses the specified `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:bsl/vector-00d/2constructor-0c8a.adoc[vector](ALLOCATOR const& basicAllocator) noexcept;
----

[.small]#xref:bsl/vector-00d/2constructor-0c8a.adoc[_» more&period;&period;&period;_]#

Create a vector of the specified `initialSize` default&hyphen;constructed elements&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:bsl/vector-00d/2constructor-07.adoc[vector](
    xref:bsl/vector-00d/size_type.adoc[size&lowbar;type] initialSize,
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/vector-00d/2constructor-07.adoc[_» more&period;&period;&period;_]#

Create a vector having the same value as the specified `original` object that uses the specified `basicAllocator` to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/2constructor-0e5.adoc[vector](
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;vector&gt;] original,
    ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/vector-00d/2constructor-0e5.adoc[_» more&period;&period;&period;_]#

Create a vector and insert (in order) each `VALUE&lowbar;TYPE` object in the specified `values` initializer list&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/2constructor-031.adoc[vector](
    std::initializer&lowbar;list&lt;VALUE&lowbar;TYPE&gt; values,
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/vector-00d/2constructor-031.adoc[_» more&period;&period;&period;_]#

Create a vector having the same value as the specified `original` object that uses the specified `basicAllocator` to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/2constructor-01a.adoc[vector](
    xref:bsl/vector-00d.adoc[vector] const& original,
    ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/vector-00d/2constructor-01a.adoc[_» more&period;&period;&period;_]#

Create a vector of `initialSize` elements each equal to `value`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/2constructor-0e1.adoc[vector](
    xref:bsl/vector-00d/size_type.adoc[size&lowbar;type] initialSize,
    VALUE&lowbar;TYPE const& value,
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/vector-00d/2constructor-0e1.adoc[_» more&period;&period;&period;_]#

Create a vector from the specified iterator range&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITER&gt;
xref:bsl/vector-00d/2constructor-051.adoc[vector](
    INPUT&lowbar;ITER first,
    INPUT&lowbar;ITER last,
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/vector-00d/2constructor-051.adoc[_» more&period;&period;&period;_]#

Create a vector from the elements of the specifed `range`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;RANGE&gt;
xref:bsl/vector-00d/2constructor-0d.adoc[vector](
    std::from&lowbar;range&lowbar;t unused,
    t&lowbar;RANGE&& range,
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/vector-00d/2constructor-0d.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *original*
| vector whose value to copy
| *basicAllocator*
| allocator used to supply memory
| *initialSize*
| number of elements to create
| *values*
| initializer list of elements
| *value*
| value copied into each element
| *first*
| the start of the iterator range
| *last*
| one past the end of the iterator range
| *unused*
| tag selecting the from&hyphen;range constructor overload
| *range*
| input range of elements
|===


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