[#bsl-list-054-2constructor-028] = xref:bsl.adoc[bsl]::xref:bsl/list-054.adoc[list]::list :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<bslstl_list.h>` Create an empty list. A default‐constructed object of the (template parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator`, the currently installed default allocator is used. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/2constructor-02f.adoc[list](); ---- [.small]#xref:bsl/list-054/2constructor-02f.adoc[_» more..._]# Create a list having 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 allocate memory. This method requires that the (template parameter) type `VALUE` be `copy‐insertable` into this list (see {Requirements on `VALUE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/2constructor-016.adoc[list](xref:bsl/list-054.adoc[list] const& original); ---- [.small]#xref:bsl/list-054/2constructor-016.adoc[_» more..._]# Create a list of the specified `numElements` size whose every element is default‐constructed. A default‐constructed object of the (template parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator`, the currently installed default allocator is used. Throw `bsl::length_error` if `numElements > max_size()`. This method requires that the (template parameter) `VALUE` be `default‐insertable` into this list (see {Requirements on `VALUE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/list-054/2constructor-06e.adoc[list](xref:bsl/list-054/size_type.adoc[size_type] numElements); ---- [.small]#xref:bsl/list-054/2constructor-06e.adoc[_» more..._]# Create a list having the same value as the specified `original` object by moving (in constant time) the contents of `original` to the new list. The allocator associated with `original` is propagated for use in the newly‐created list. `original` is left in a valid but unspecified state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/2constructor-065.adoc[list](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<list>] original); ---- [.small]#xref:bsl/list-054/2constructor-065.adoc[_» more..._]# Create an empty list. Use the specified `basicAllocator` to supply memory. If the type `ALLOCATOR` is `bsl::allocator` (the default), then `basicAllocator` shall be convertible to `bslma::Allocator *`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/list-054/2constructor-08.adoc[list](ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/list-054/2constructor-08.adoc[_» more..._]# Create a list of the specified `numElements` size whose every element is default‐constructed. Use the specified `basicAllocator` to supply memory. If the type `ALLOCATOR` is `bsl::allocator` (the default), then `basicAllocator` shall be convertible to `bslma::Allocator *`. Throw `bsl::length_error` if `numElements > max_size()`. This method requires that the (template parameter) `VALUE` be `default‐insertable` into this list (see {Requirements on `VALUE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/2constructor-018.adoc[list]( xref:bsl/list-054/size_type.adoc[size_type] numElements, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/list-054/2constructor-018.adoc[_» more..._]# Create a list 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 list 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` be `move‐insertable` into this list (see {Requirements on `VALUE`}). 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/list-054/2constructor-0a.adoc[list]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<list>] original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/list-054/2constructor-0a.adoc[_» more..._]# Create a list 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` be `copy‐insertable` into this list (see {Requirements on `VALUE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/2constructor-09.adoc[list]( std::initializer_list<value_type> values, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/list-054/2constructor-09.adoc[_» more..._]# Create a list that has the same value as the specified `original` object. Use the specified `basicAllocator` to supply memory. This method requires that the (template parameter) `VALUE` be `copy‐insertable` into this list (see {Requirements on `VALUE`}). 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/list-054/2constructor-0f.adoc[list]( xref:bsl/list-054.adoc[list] const& original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/list-054/2constructor-0f.adoc[_» more..._]# Create a list 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` be `copy‐insertable` into this list (see {Requirements on `VALUE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/2constructor-043.adoc[list]( xref:bsl/list-054/size_type.adoc[size_type] numElements, xref:bsl/list-054/value_type.adoc[value_type] const& value, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/list-054/2constructor-043.adoc[_» more..._]# Create a list 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 list, where `i` is a dereferenceable iterator in the range `[first .. last)]` (see {Requirements on `VALUE`}). 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/list-054/2constructor-04f.adoc[list]( INPUT_ITERATOR first, INPUT_ITERATOR last, ALLOCATOR const& basicAllocator = ALLOCATOR()) requires !is_arithmetic<INPUT_ITERATOR>::value && !is_enum<INPUT_ITERATOR>::value; ---- [.small]#xref:bsl/list-054/2constructor-04f.adoc[_» more..._]# Create a list 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`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_RANGE> xref:bsl/list-054/2constructor-04a.adoc[list]( std::from_range_t, t_RANGE&& range, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/list-054/2constructor-04a.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#