Constructors
Synopses
Declared in <bslstl_unorderedset.h>
Create an empty unordered set. Optionally specify an initialNumBuckets indicating the initial size of the array of buckets of this container. If initialNumBuckets is not supplied, a single bucket is used. Optionally specify a hashFunction used to generate the hash values for the keys contained in this set. If hashFunction is not supplied, a default‐constructed object of the (template parameter) type HASH is used. Optionally specify a key‐equality functor keyEqual used to verify that two key are equivalent. If keyEqual is not supplied, a default‐constructed object of the (template parameter) type EQUAL 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 to supply memory. Note that a bslma::Allocator * can be supplied for basicAllocator if the type ALLOCATOR is bsl::allocator (the default).
Create an unordered 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.hash_function() to generate hash values for the keys contained in this set. Use a copy of original.key_eq() to verify that two keys are equivalent. The allocator associated with original is propagated for use in the newly‐created set. original is left in a valid but unspecified state.
Create an empty unordered set using the specified basicAllocator.
explicit
unordered_set(allocator<ManagedAttribute> const& basicAllocator);
Create an unordered set having the same value as the specified original object. Use a copy of original.hash_function() to generate hash values for the keys contained in this set. Use a copy of original.key_eq() to verify that two keys are equivalent. 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}).
unordered_set(unordered_set<ManagedAttribute, AttributeHash> const& original);
Same as the preceding overload, using the specified allocator.
unordered_set(
size_type initialNumBuckets,
allocator<ManagedAttribute> const& basicAllocator);
Create an unordered 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.hash_function() to generate hash values for the keys contained in this set. Use a copy of original.key_eq() to verify that two keys are equivalent. This method requires that the (template parameter) type KEY be move‐insertable (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).
unordered_set(
BloombergLP::bslmf::MovableRef<unordered_set<ManagedAttribute, AttributeHash>> original,
type_identity<allocator<ManagedAttribute>>::type const& basicAllocator);
Create an unordered set having the same value as the specified original object that uses the specified basicAllocator to supply memory. Use a copy of original.hash_function() to generate hash values for the keys contained in this set. Use a copy of original.key_eq() to verify that two keys are equivalent. 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).
unordered_set(
unordered_set<ManagedAttribute, AttributeHash> const& original,
type_identity<allocator<ManagedAttribute>>::type const& basicAllocator);
Create an unordered 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 an initialNumBuckets indicating the initial size of the array of buckets of this container. If initialNumBuckets is not supplied, a single bucket is used. Optionally specify a hashFunction used to generate the hash values for the keys contained in this set. If hashFunction is not supplied, a default‐constructed object of the (template parameter) type HASH is used. Optionally specify a key‐equality functor keyEqual used to verify that two keys are equivalent. If keyEqual is not supplied, a default‐constructed object of the (template parameter) type EQUAL 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 to supply memory. This method requires that the (template parameter) type KEY be copy‐constructible (see {Requirements on KEY}). Note that a bslma::Allocator * can be supplied for basicAllocator if the type ALLOCATOR is bsl::allocator (the default).
template<>
requires bsl::IsStdAllocator<ALLOCATOR>::value
unordered_set(
std::initializer_list<ManagedAttribute> values,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified allocator.
unordered_set(
size_type initialNumBuckets,
AttributeHash const& hashFunction,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified allocator.
template<>
requires bsl::IsStdAllocator<ALLOCATOR>::value
unordered_set(
std::initializer_list<ManagedAttribute> values,
size_type initialNumBuckets,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified allocator.
template<class INPUT_ITERATOR>
unordered_set(
INPUT_ITERATOR first,
INPUT_ITERATOR last,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified allocator.
template<class RANGE>
unordered_set(
std::from_range_t,
RANGE&& range,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified bucket count and hash/equality functors.
explicit
unordered_set(
size_type initialNumBuckets,
AttributeHash const& hashFunction = HASH(),
equal_to<ManagedAttribute> const& keyEqual = EQUAL(),
allocator<ManagedAttribute> const& basicAllocator = ALLOCATOR());
Same as the preceding overload, using the specified allocator.
template<>
requires std::is_invocable_v<HASH, const KEY &> && bsl::IsStdAllocator<ALLOCATOR>::value
unordered_set(
std::initializer_list<ManagedAttribute> values,
size_type initialNumBuckets,
AttributeHash const& hashFunction,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified allocator.
template<class INPUT_ITERATOR>
unordered_set(
INPUT_ITERATOR first,
INPUT_ITERATOR last,
size_type initialNumBuckets,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified allocator.
template<class RANGE>
unordered_set(
std::from_range_t,
RANGE&& range,
size_type initialNumBuckets,
allocator<ManagedAttribute> const& basicAllocator);
Create an unordered set from the specified values initializer list.
template<>
requires std::is_invocable_v<HASH, const KEY &> && std::is_invocable_v<EQUAL, const KEY &, const KEY &> && bsl::IsStdAllocator_v<ALLOCATOR>
unordered_set(
std::initializer_list<ManagedAttribute> values,
size_type initialNumBuckets = 0,
AttributeHash const& hashFunction = HASH(),
equal_to<ManagedAttribute> const& keyEqual = EQUAL(),
allocator<ManagedAttribute> const& basicAllocator = ALLOCATOR());
Same as the preceding overload, using the specified allocator.
template<class INPUT_ITERATOR>
unordered_set(
INPUT_ITERATOR first,
INPUT_ITERATOR last,
size_type initialNumBuckets,
AttributeHash const& hashFunction,
allocator<ManagedAttribute> const& basicAllocator);
Same as the preceding overload, using the specified allocator.
template<class RANGE>
unordered_set(
std::from_range_t,
RANGE&& range,
size_type initialNumBuckets,
AttributeHash const& hashFunction,
allocator<ManagedAttribute> const& basicAllocator);
Create an unordered 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 an initialNumBuckets indicating the initial size of the array of buckets of this container. If initialNumBuckets is not supplied, a single bucket is used. Optionally specify a hashFunction used to generate hash values for the keys contained in this set. If hashFunction is not supplied, a default‐constructed object of (template parameter) type HASH is used. Optionally specify a key‐equality functor keyEqual used to verify that two key values are the same. If keyEqual is not supplied, a default‐constructed object of (template parameter) type EQUAL 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 to supply memory. 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 unordered 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).
template<class INPUT_ITERATOR>
unordered_set(
INPUT_ITERATOR first,
INPUT_ITERATOR last,
size_type initialNumBuckets = 0,
AttributeHash const& hashFunction = HASH(),
equal_to<ManagedAttribute> const& keyEqual = EQUAL(),
allocator<ManagedAttribute> const& basicAllocator = ALLOCATOR());
Create an unordered set, and insert each value_type object in the specified range, ignoring those keys having a value equivalent to that which appears earlier in the range. Optionally specify an initialNumBuckets indicating the initial size of the array of buckets of this container. If initialNumBuckets is not supplied, an implementation‐defined value is used. Optionally specify a hashFunction used to generate the hash values for each key value contained in this set. If hashFunction is not supplied, a default‐constructed object of the (template parameter) type HASH is used. Optionally specify a key‐equality functor keyEqual used to determine whether two keys have the same value. If keyEqual is not supplied, a default‐constructed object of the (template parameter) type EQUAL 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. This operation has O[N] complexity, where N is the number of elements in range. 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.
template<class RANGE>
unordered_set(
std::from_range_t,
RANGE&& range,
size_type initialNumBuckets = 0,
AttributeHash const& hashFunction = HASH(),
equal_to<ManagedAttribute> const& keyEqual = EQUAL(),
allocator<ManagedAttribute> const& basicAllocator = ALLOCATOR());
Created with MrDocs