[#bsl-set-0d-2constructor-006] = xref:bsl.adoc[bsl]::xref:bsl/set-0d.adoc[set]::set :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<bslstl_set.h>` Create an empty set. Optionally specify a `comparator` used to order keys contained in this object. If `comparator` is not supplied, a default‐constructed object of the (template parameter) type `COMPARATOR` is used. 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` and `basicAllocator` is not supplied, the currently installed default allocator is used. Note that a `bslma::Allocator *` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl::allocator` (the default). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/set-0d/2constructor-095.adoc[set](); ---- [.small]#xref:bsl/set-0d/2constructor-095.adoc[_» more..._]# Create a set having the same value as the specified `original` object. Use a copy of `original.key_comp()` to order the keys contained in this set. 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 `KEY` be `copy‐insertable` into this set (see {Requirements on `KEY`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/set-0d/2constructor-097.adoc[set](xref:bsl/set-0d.adoc[set] const& original); ---- [.small]#xref:bsl/set-0d/2constructor-097.adoc[_» more..._]# Create a set having the same value as the specified `original` object by moving (in constant time) the contents of `original` to the new set. Use a copy of `original.key_comp()` to order the keys contained in this set. The allocator associated with `original` is propagated for use in the newly‐created set. `original` is left in a valid but unspecified state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/set-0d/2constructor-02.adoc[set](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<set>] original); ---- [.small]#xref:bsl/set-0d/2constructor-02.adoc[_» more..._]# Create an empty set that uses the specified `basicAllocator` to supply memory. Use a default‐constructed object of the (template parameter) type `COMPARATOR` to order the keys contained in this set. 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"] ---- explicit xref:bsl/set-0d/2constructor-0d6.adoc[set](ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/set-0d/2constructor-0d6.adoc[_» more..._]# Create a set 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 set if `basicAllocator == original.get_allocator()`, and are move‐ inserted (in linear time) using `basicAllocator` otherwise. `original` is left in a valid but unspecified state. Use a copy of `original.key_comp()` to order the keys contained in this set. This method requires that the (template parameter) type `KEY` be `move‐insertable` into this set (see {Requirements on `KEY`}). 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/set-0d/2constructor-08.adoc[set]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<set>] original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/set-0d/2constructor-08.adoc[_» more..._]# Same as the preceding overload, using the specified `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/set-0d/2constructor-05.adoc[set]( std::initializer_list<KEY> values, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/set-0d/2constructor-05.adoc[_» more..._]# Same as the preceding overload, using the specified `comparator` and `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/set-0d/2constructor-0e.adoc[set]( COMPARATOR const& comparator, ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/set-0d/2constructor-0e.adoc[_» more..._]# Create a set having the same value as the specified `original` object that uses the specified `basicAllocator` to supply memory. Use a copy of `original.key_comp()` to order the keys contained in this set. This method requires that the (template parameter) type `KEY` be `copy‐insertable` into this set (see {Requirements on `KEY`}). 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/set-0d/2constructor-00b.adoc[set]( xref:bsl/set-0d.adoc[set] const& original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/set-0d/2constructor-00b.adoc[_» more..._]# Create a set and insert each `value_type` object in the specified `values` initializer list, ignoring those keys having a value equivalent to that which appears earlier in the list. Optionally specify a `comparator` used to order keys contained in this object. If `comparator` is not supplied, a default‐constructed object of the (template parameter) type `COMPARATOR` is used. 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` and `basicAllocator` is not supplied, the currently installed default allocator is used. If `values` is ordered according to `comparator`, then this operation has `O[N]` complexity, where `N` is the number of elements in `list`; otherwise this operation has `O[N * log(N)]` complexity. This method requires that the (template parameter) type `KEY` be `copy‐insertable` into this set (see {Requirements on `KEY`}). Note that a `bslma::Allocator *` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl::allocator` (the default). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/set-0d/2constructor-03.adoc[set]( std::initializer_list<KEY> values, COMPARATOR const& comparator = COMPARATOR(), ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/set-0d/2constructor-03.adoc[_» more..._]# Same as the preceding overload, using the specified `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/set-0d/2constructor-06.adoc[set]( INPUT_ITERATOR first, INPUT_ITERATOR last, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/set-0d/2constructor-06.adoc[_» more..._]# Create a set from the specified `range`, using the specified `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class RANGE> xref:bsl/set-0d/2constructor-0d1.adoc[set]( std::from_range_t, RANGE&& range, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/set-0d/2constructor-0d1.adoc[_» more..._]# Create a set, and insert each `value_type` object in the sequence starting at the specified `first` element, and ending immediately before the specified `last` element, ignoring those keys having a value equivalent to that which appears earlier in the sequence. Optionally specify a `comparator` used to order keys contained in this object. If `comparator` is not supplied, a default‐constructed object of the (template parameter) type `COMPARATOR` is used. 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` and `basicAllocator` is not supplied, the currently installed default allocator is used. If the sequence `first` to `last` is ordered according to `comparator`, then this operation has `O[N]` complexity, where `N` is the number of elements between `first` and `last`, otherwise this operation has `O[N * log(N)]` complexity. The (template parameter) type `INPUT_ITERATOR` shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3]providing access to values of a type convertible to `value_type`, and `value_type` must be `emplace‐constructible` from `*i` into this set, where `i` is a dereferenceable iterator in the range `[first .. last)]` (see {Requirements on `KEY`}). 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`. Note that a `bslma::Allocator *` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl::allocator` (the default). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/set-0d/2constructor-01.adoc[set]( INPUT_ITERATOR first, INPUT_ITERATOR last, COMPARATOR const& comparator = COMPARATOR(), ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/set-0d/2constructor-01.adoc[_» more..._]# Create a set having the (`value_type`) values obtained from the specified `range`. Ignore those those objects having a key equivalent to that which appears earlier in the sequence. Optionally specify a `comparator` used to order key‐value pairs contained in this object. If `comparator` is not supplied, a default‐constructed object of the (template parameter) type `COMPARATOR` is used. 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. If values obtained from `range are ordered according to `comparator`, then this operation has `O[N]` complexity, where `N` is the number of values in the `range`; otherwise, this operation has `O[N * log(N)]` complexity. Note that `RANGE` must meet the requirements of an input range and the values from `range` must have a type matching or convertible to `value_type`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class RANGE> xref:bsl/set-0d/2constructor-0b.adoc[set]( std::from_range_t, RANGE&& range, COMPARATOR const& comparator = COMPARATOR(), ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/set-0d/2constructor-0b.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#