[#bsl-deque-0c-2constructor-0f62] = xref:bsl.adoc[bsl]::xref:bsl/deque-0c.adoc[deque]::deque :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<bslstl_deque.h>` Create an empty deque. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is not supplied, a default‐constructed object of the (template parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the type `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/deque-0c/2constructor-0d6.adoc[deque](); ---- [.small]#xref:bsl/deque-0c/2constructor-0d6.adoc[_» more..._]# Create a deque that has the same value as the specified `original` object. Use the allocator returned by 'bsl::allocator_traits<ALLOCATOR>:: select_on_container_copy_construction(original.get_allocator())' to supply memory. If the (template parameter) type `ALLOCATOR` is `bsl::allocator` (the default), the currently installed default allocator is used. This method requires that the (template parameter) `VALUE_TYPE` be `copy‐insertable` into this deque (see {Requirements on `VALUE_TYPE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/deque-0c/2constructor-0e.adoc[deque](xref:bsl/deque-0c.adoc[deque] const& original); ---- [.small]#xref:bsl/deque-0c/2constructor-0e.adoc[_» more..._]# Create a deque having the same value as the specified `original` object by moving (in constant time) the contents of `original` to the new deque. The allocator associated with `original` is propagated for use in the newly‐created deque. `original` is left in a valid but unspecified state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/deque-0c/2constructor-0a.adoc[deque](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<deque>] original); ---- [.small]#xref:bsl/deque-0c/2constructor-0a.adoc[_» more..._]# Same as the related overload above for `deque`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/deque-0c/2constructor-01.adoc[deque](ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/deque-0c/2constructor-01.adoc[_» more..._]# Create a deque of the specified `numElements` size whose every element is value‐initialized. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is not supplied, a default‐constructed object of the (template parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the type `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used. Throw `bsl::length_error` if `numElements > max_size()`. This method requires that the (template parameter) `VALUE_TYPE` be `default‐insertable` into this deque (see {Requirements on `VALUE_TYPE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/deque-0c/2constructor-0db.adoc[deque]( xref:bsl/deque-0c/size_type.adoc[size_type] numElements, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/deque-0c/2constructor-0db.adoc[_» more..._]# Create a deque having the same value as the specified `original` object that uses the specified `basicAllocator` to supply memory. The contents of `original` are moved (in constant time) to the new deque if `basicAllocator == original.get_allocator()`, and are move‐ inserted (in linear time) using `basicAllocator` otherwise. `original` is left in a valid but unspecified state. This method requires that the (template parameter) `VALUE_TYPE` be `move‐insertable` into this deque (see {Requirements on `VALUE_TYPE`}). Note that a `bslma::Allocator *` can be supplied for `basicAllocator` if the (template parameter) `ALLOCATOR` is `bsl::allocator` (the default). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/deque-0c/2constructor-08.adoc[deque]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<deque>] original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/deque-0c/2constructor-08.adoc[_» more..._]# Create a deque and append each `value_type` object in the specified `values` initializer list. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is not supplied, a default‐constructed object of the (template parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the type `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used. This method requires that the (template parameter) `VALUE_TYPE` be `copy‐insertable` into this deque (see {Requirements on `VALUE_TYPE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/deque-0c/2constructor-0c.adoc[deque]( std::initializer_list<value_type> values, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/deque-0c/2constructor-0c.adoc[_» more..._]# Create a deque that has the same value as the specified `original` object and that uses the specified `basicAllocator` to supply memory. This method requires that the (template parameter) `VALUE_TYPE` be `copy‐insertable` into this deque (see {Requirements on `VALUE_TYPE`}). Note that a `bslma::Allocator *` can be supplied for `basicAllocator` if the (template parameter) type `ALLOCATOR` is `bsl::allocator` (the default). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/deque-0c/2constructor-02.adoc[deque]( xref:bsl/deque-0c.adoc[deque] const& original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/deque-0c/2constructor-02.adoc[_» more..._]# Create a deque of the specified `numElements` size whose every element has the specified `value`. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is not supplied, a default‐constructed object of the (template parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the type `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used. Throw `bsl::length_error` if `numElements > max_size()`. This method requires that the (template parameter) `VALUE_TYPE` be `copy‐insertable` into this deque (see {Requirements on `VALUE_TYPE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/deque-0c/2constructor-05.adoc[deque]( xref:bsl/deque-0c/size_type.adoc[size_type] numElements, VALUE_TYPE const& value, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/deque-0c/2constructor-05.adoc[_» more..._]# Create a deque initially containing copies of the values in the range starting at the specified `first` and ending immediately before the specified `last` iterators of the (template parameter) type `INPUT_ITERATOR`. Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is not supplied, a default‐constructed object of the (template parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the type `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used. Throw `bsl::length_error` if the number of elements in `[first .. last)]` exceeds the size returned by `max_size`. The (template parameter) type `INPUT_ITERATOR` shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators]providing access to values of a type convertible to `value_type`, and `value_type` must be `emplace‐constructible` from `*i` into this deque, where `i` is a dereferenceable iterator in the range `[first .. last)]` (see {Requirements on `VALUE_TYPE`}). The behavior is undefined unless `first` and `last` refer to a sequence of valid values where `first` is at a position at or before `last`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/deque-0c/2constructor-0f6d.adoc[deque]( INPUT_ITERATOR first, INPUT_ITERATOR last, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/deque-0c/2constructor-0f6d.adoc[_» more..._]# Create a deque from the elements of the specifed `range`. Optionally specify an `basicAllocator` used to supply memory. If `basicAllocator` is not specified, a default‐constructed object of the (template parameter) type `ALLOCATOR` is used. 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_TYPE`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_RANGE> xref:bsl/deque-0c/2constructor-06.adoc[deque]( std::from_range_t, t_RANGE&& range, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/deque-0c/2constructor-06.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#