[#bsl-vector-0ea-2constructor-0fa]
= xref:bsl.adoc[bsl]::xref:bsl/vector-0ea.adoc[vector&lt;double&gt;]::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-0ea/2constructor-0d.adoc[vector]() noexcept;
----

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

Create a vector having the same value as the specified `original` object by moving (in constant time) the contents of `original` to the new vector&period; The allocator associated with `original` is propagated for use in the newly&hyphen;created vector&period; `original` is left in a valid but unspecified state&period;


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

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

Create an empty vector&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not specified, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:bsl/vector-0ea/2constructor-072.adoc[vector](xref:bsl/allocator-0df.adoc[allocator&lt;double&gt;] const& basicAllocator) noexcept;
----

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

Create a vector having the same value as the specified `original` object&period; Use the allocator returned by &apos;bsl&colon;&colon;allocator&lowbar;traits&lt;ALLOCATOR&gt;&colon;&colon; select&lowbar;on&lowbar;container&lowbar;copy&lowbar;construction(original&period;get&lowbar;allocator())&apos; to allocate memory&period; This method requires that the (template parameter) type `VALUE&lowbar;TYPE` be `copy&hyphen;insertable` into this vector (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-0ea/2constructor-0a.adoc[vector](xref:bsl/vector-00d.adoc[vector&lt;double&gt;] const& original);
----

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

Create a vector of the specified `initialSize` whose every element is a default&hyphen;constructed object of the (template parameter) type `VALUE&lowbar;TYPE`&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not specified, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; Throw `std&colon;&colon;length&lowbar;error` if `initialSize &gt; max&lowbar;size()`&period; This method requires that the type `VALUE&lowbar;TYPE` be `default&hyphen;insertable` into this vector (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:bsl/vector-0ea/2constructor-04.adoc[vector](
    xref:bsl/vector-0ea/size_type.adoc[size&lowbar;type] initialSize,
    xref:bsl/allocator-0df.adoc[allocator&lt;double&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/vector-0ea/2constructor-04.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; The contents of `original` are moved (in constant time) to the new vector if `basicAllocator &equals;&equals; original&period;get&lowbar;allocator()`, and are move&hyphen;inserted (in linear time) using `basicAllocator` otherwise&period; `original` is left in a valid but unspecified state&period; This method requires that the (template parameter) type `VALUE&lowbar;TYPE` be `move&hyphen;insertable` into this vector (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the (template parameter) type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-0ea/2constructor-07e.adoc[vector](
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;vector&lt;double&gt;&gt;] original,
    type&lowbar;identity&lt;allocator&lt;double&gt;&gt;::type const& basicAllocator);
----

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

Create a vector and insert (in order) each `VALUE&lowbar;TYPE` object in the specified `values` initializer list&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not specified, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; This method requires that the (template parameter) type `VALUE&lowbar;TYPE` be `copy&hyphen;insertable` into this vector (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-0ea/2constructor-0fd.adoc[vector](
    std::initializer&lowbar;list&lt;double&gt; values,
    xref:bsl/allocator-0df.adoc[allocator&lt;double&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/vector-0ea/2constructor-0fd.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; This method requires that the (template parameter) type `VALUE&lowbar;TYPE` be `copy&hyphen;insertable` into this vector (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the (template parameter) type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-0ea/2constructor-093.adoc[vector](
    xref:bsl/vector-00d.adoc[vector&lt;double&gt;] const& original,
    type&lowbar;identity&lt;allocator&lt;double&gt;&gt;::type const& basicAllocator);
----

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

Create a vector of the specified `initialSize` whose every element is a copy of the specified `value`&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not specified, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; Throw `std&colon;&colon;length&lowbar;error` if `initialSize &gt; max&lowbar;size()`&period; This method requires that the (template parameter) type `VALUE&lowbar;TYPE` be `copy&hyphen;insertable` into this vector (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-0ea/2constructor-09a.adoc[vector](
    xref:bsl/vector-0ea/size_type.adoc[size&lowbar;type] initialSize,
    double const& value,
    xref:bsl/allocator-0df.adoc[allocator&lt;double&gt;] const& basicAllocator = ALLOCATOR());
----

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

Create a vector, and insert (in order) each `VALUE&lowbar;TYPE` object in the range starting at the specified `first` element, and ending immediately before the specified `last` element&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not specified, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; Throw `std&colon;&colon;length&lowbar;error` if the number of elements in `&lsqb;first &period;&period; last)&rsqb;` exceeds the value returned by the method `max&lowbar;size`&period; The (template parameter) type `INPUT&lowbar;ITER` shall meet the requirements of an input iterator defined in the C&plus;&plus;11 standard &lsqb;24&period;2&period;3&rsqb;providing access to values of a type convertible to `value&lowbar;type`, and `value&lowbar;type` must be `emplace&hyphen;constructible` from `&ast;i` into this vector, where `i` is a dereferenceable iterator in the range `&lsqb;first &period;&period; last)&rsqb;` (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; The behavior is undefined unless `first` and `last` refer to a range of valid values where `first` is at a position at or before `last`&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITER&gt;
xref:bsl/vector-0ea/2constructor-09f.adoc[vector](
    INPUT&lowbar;ITER first,
    INPUT&lowbar;ITER last,
    xref:bsl/allocator-0df.adoc[allocator&lt;double&gt;] const& basicAllocator = ALLOCATOR());
----

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

Create a vector from the elements of the specifed `range`&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not specified, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; Note that `range` must meet the requirements of an input range and the values from `range` must have a type matching or convertible to (template parameter) `VALUE&lowbar;TYPE`&period;


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

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


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