Represents a collection of keys and values.
key_t
. key_t
implements the xtd::iequatable <type_t> generic interface, the default equality comparer uses that implementation. auto
key type and the value type. For example: Public Aliases | |
using | key_type = typename xtd::collections::generic::idictionary< key_t, value_t >::key_type |
Represents the dictionary key type. | |
using | mapped_type = typename xtd::collections::generic::idictionary< key_t, value_t >::mapped_type |
Represents the dictionary mapped type. | |
using | value_type = typename xtd::collections::generic::idictionary< key_type, mapped_type >::value_type |
Represents the dictionary value type. | |
using | size_type = xtd::size |
Represents the dictionary size type. | |
using | difference_type = xtd::ptrdiff |
Represents the dictionary difference type. | |
using | hasher = hasher_t |
Represents the dictionary hasher type. | |
using | equator = equator_t |
Represents the dictionary equator type. | |
using | key_equal = equator_t |
Represents the dictionary equator type. | |
using | allocator_type = allocator_t |
Represents the dictionary allocator type. | |
using | base_value_type = std::pair< const key_t, value_t > |
Represents the dictionary base value type. | |
using | base_type = std::unordered_map< key_type, mapped_type, hasher, key_equal, allocator_type > |
Represents the dictionary base type. | |
using | reference = value_type & |
Represents the dictionary reference type. | |
using | const_reference = const value_type & |
Represents the dictionary const reference type. | |
using | pointer = typename std::allocator_traits< allocator_t >::pointer |
Represents the dictionary pointer type. | |
using | const_pointer = typename std::allocator_traits< allocator_t >::const_pointer |
Represents the dictionary const pointer type. | |
using | iterator = typename xtd::collections::generic::idictionary< key_type, mapped_type >::iterator |
Represents the iterator of dictionary value type. | |
using | const_iterator = typename xtd::collections::generic::idictionary< key_type, mapped_type >::const_iterator |
Represents the const iterator of dictionary value type. | |
using | local_iterator = typename base_type::local_iterator |
Represents the local iterator of dictionary value type. | |
using | const_local_iterator = typename base_type::const_local_iterator |
Represents the const local iterator of dictionary value type. | |
using | node_type = typename base_type::node_type |
Represents the dictionary node type. | |
using | insert_return_type = typename base_type::insert_return_type |
Represents the dictionary insert return type. | |
using | key_collection = typename xtd::collections::generic::idictionary< key_type, mapped_type >::key_collection |
Represents the idictionary key collection type. | |
using | value_collection = typename xtd::collections::generic::idictionary< key_type, mapped_type >::value_collection |
Represents the idictionary value collection type. | |
Public Constructors | |
dictionary () noexcept=default | |
Initializes a new instance of the xtd::collections::generic::dictionary <key_t, value_t> class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. | |
dictionary (size_type bucket_count, const hasher &hash=hasher {}, const equator &equal=equator {}, const allocator_type &alloc=allocator_type {}) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (size_type bucket_count, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (size_type bucket_count, const hasher &hash, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
template<typename input_iterator_t > | |
dictionary (input_iterator_t first, input_iterator_t last, size_type bucket_count=0, const hasher &hash=hasher {}, const equator &equal=equator {}, const allocator_type &alloc=allocator_type {}) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
template<typename input_iterator_t > | |
dictionary (input_iterator_t first, input_iterator_t last, size_type bucket_count, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
template<typename input_iterator_t > | |
dictionary (input_iterator_t first, input_iterator_t last, size_type bucket_count, const hasher &hash, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (const dictionary &other) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (const dictionary &other, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (const std::unordered_map< key_t, value_t > &other) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (const std::unordered_map< key_t, value_t > &other, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (dictionary &&other) noexcept=default | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (dictionary &&other, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (std::unordered_map< key_t, value_t > &&other) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (std::unordered_map< key_t, value_t > &&other, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (std::initializer_list< base_value_type > init, size_type bucket_count=0, const hasher &hash=hasher {}, const equator &equal=equator {}, const allocator_type &alloc=allocator_type {}) | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (std::initializer_list< base_value_type > init, size_type bucket_count, const allocator_type &alloc) | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
dictionary (std::initializer_list< base_value_type > init, size_type bucket_count, const hasher &hash, const allocator_type &alloc) noexcept | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
template<typename init_key_t , typename init_value_t > | |
dictionary (std::initializer_list< key_value_pair< init_key_t, init_value_t > > init, size_type bucket_count=0, const hasher &hash=hasher {}, const equator &equal=equator {}, const allocator_type &alloc=allocator_type {}) | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
template<typename init_key_t , typename init_value_t > | |
dictionary (std::initializer_list< key_value_pair< init_key_t, init_value_t > > init, size_type bucket_count, const allocator_type &alloc) | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
template<typename init_key_t , typename init_value_t > | |
dictionary (std::initializer_list< key_value_pair< init_key_t, init_value_t > > init, size_type bucket_count, const hasher &hash, const allocator_type &alloc) | |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator. | |
Public Properties | |
const_iterator | begin () const noexcept override |
Returns an iterator to the first element of the enumarable. | |
iterator | begin () noexcept override |
Returns an iterator to the first element of the enumarable. | |
size_type | bucket_count () const noexcept |
Gets the number of buckets in the container. | |
size_type | capacity () const noexcept |
Gets the total numbers of elements the internal data structure can hold without resizing. | |
const_iterator | cbegin () const noexcept override |
Returns an iterator to the first element of the enumarable. | |
const_iterator | cend () const noexcept override |
Returns an iterator to the element following the last element of the enumarable. | |
size_type | count () const noexcept |
Gets the number of key/value pairs contained in the xtd::collections::generic::dictionary <key_t, value_t>. | |
bool | empty () const noexcept |
Checks if the container has no elements, i.e. whether begin() == end() . | |
const_iterator | end () const noexcept override |
Returns an iterator to the element following the last element of the enumarable. | |
iterator | end () noexcept override |
Returns an iterator to the element following the last element of the enumarable. | |
virtual const base_type & | items () const noexcept |
Returns the underlying base type items. | |
virtual base_type & | items () noexcept |
Returns the underlying base type items. | |
key_collection | keys () const noexcept override |
Gets a collection containing the keys in the xtd::collections::generic::dictionary <key_t, value_t>. | |
float | load_factor () const |
Gets the average number of elements per bucket, that is, xtd::collections::generic::dictionary::size divided by xtd::collections::generic::dictionary::bucket_count. | |
size_type | max_bucket_count () const noexcept |
Gets the maximum number of buckets the container is able to hold due to system or library implementation limitations. | |
float | max_load_factor () const |
Gets the maximum load factor (number of elements per bucket). The container automatically increases the number of buckets if the load factor exceeds this threshold. | |
void | max_load_factor (float value) const |
Sets the maximum load factor (number of elements per bucket). The container automatically increases the number of buckets if the load factor exceeds this threshold. | |
size_type | max_size () const noexcept |
Gets the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container. | |
size_type | size () const noexcept |
Gets the number of key/value pairs contained in the xtd::collections::generic::dictionary <key_t, value_t>. | |
value_collection | values () const noexcept override |
Gets a collection containing the values in the xtd::collections::generic::dictionary <key_t, value_t>. | |
Public Methods | |
void | add (const key_t &key, const value_t value) override |
Adds an element with the provided key and value to the xtd::collections::generic::dictionary <key_t, value_t>. | |
const value_t & | at (const key_t &key) const |
Gets the element with the specified key. | |
value_t & | at (const key_t &key) |
Gets the element with the specified key. | |
size_type | bucket (const key_t &key) const |
Returns the index of the bucket for key key. Elements (if any) with keys equivalent to key are always found in this bucket. | |
size_type | bucket_size (size_type n) const noexcept |
Returns the number of elements in the bucket with index n . | |
void | clear () noexcept |
Erases all elements from the container. After this call, xtd::collections::generic::dictionary::size returns zero. | |
allocator_type | get_allocator () const noexcept |
Returns the allocator associated with the container. | |
enumerator< value_type > | get_enumerator () const noexcept override |
Returns an enumerator that iterates through the xtd::collections::generic::dictionary <key_t, value_t>. | |
Public Operators | |
dictionary & | operator= (dictionary &&other) noexcept |
Move assignment operator. Replaces the contents with a copy of the contents of other . | |
dictionary & | operator= (std::unordered_map< key_t, value_t > &&other) noexcept |
Move assignment operator. Replaces the contents with a copy of the contents of other . | |
dictionary & | operator= (const dictionary &other) noexcept=default |
Copy assignment operator. Replaces the contents with a copy of the contents of other . | |
dictionary & | operator= (const std::unordered_map< key_t, value_t > &other) noexcept |
Copy assignment operator. Replaces the contents with a copy of the contents of other . | |
dictionary & | operator= (std::initializer_list< base_value_type > ilist) |
Copy assignment operator. Replaces the contents with a copy of the contents of other . | |
template<typename init_key_t , typename init_value_t > | |
dictionary & | operator= (std::initializer_list< key_value_pair< init_key_t, init_value_t > > ilist) |
Copy assignment operator. Replaces the contents with a copy of the contents of other . | |
const value_t & | operator[] (const key_t &key) const override |
Gets the element with the specified key. | |
value_t & | operator[] (const key_t &key) override |
Sets the element with the specified key. | |
operator const base_type & () const noexcept | |
Returns a reference to the underlying base type. | |
operator base_type & () noexcept | |
Returns a reference to the underlying base type. | |
Additional Inherited Members | |
Public Types inherited from xtd::collections::generic::idictionary< key_t, value_t > | |
using | key_type = key_t |
Represents the dictionary key type. | |
using | mapped_type = value_t |
Represents the dictionary mapped type. | |
using | value_type = xtd::collections::generic::key_value_pair< key_type, mapped_type > |
Represents the dictionary value type. | |
using | iterator = typename xtd::collections::generic::icollection< value_type >::iterator |
Represents the iterator of xtd::collections::generic::ienumerable value type. | |
using | const_iterator = typename xtd::collections::generic::icollection< value_type >::const_iterator |
Represents the const iterator of xtd::collections::generic::ienumerable value type. | |
using | key_collection = xtd::collections::generic::list< key_type > |
Represents the idictionary key collection type. | |
using | value_collection = xtd::collections::generic::list< mapped_type > |
Represents the idictionary value collection type. | |
Public Types inherited from xtd::collections::generic::ienumerable< xtd::collections::generic::key_value_pair< key_t, value_t > > | |
using | iterator = typename xtd::collections::generic::extensions::enumerable_iterators< xtd::collections::generic::key_value_pair< key_t, value_t >, xtd::collections::generic::ienumerable< xtd::collections::generic::key_value_pair< key_t, value_t > > >::iterator |
Represents the iterator of xtd::collections::generic::ienumerable value type. | |
using | const_iterator = typename xtd::collections::generic::extensions::enumerable_iterators< xtd::collections::generic::key_value_pair< key_t, value_t >, xtd::collections::generic::ienumerable< xtd::collections::generic::key_value_pair< key_t, value_t > > >::const_iterator |
Represents the const iterator of xtd::collections::generic::ienumerable value type. | |
Public Types inherited from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t > | |
using | const_iterator = const iterator |
Represents the const iterator of enumarable value type. | |
Public Types inherited from xtd::collections::generic::extensions::enumerable< enumerable_t, source_t > | |
template<typename type_t > | |
using | ienumerable = typename xtd::linq::enumerable::ienumerable< type_t > |
Represents the ienumerable value type. | |
template<typename type_t > | |
using | list = typename xtd::linq::enumerable::list< type_t > |
Represents the list value type. | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<typename object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
virtual xtd::string | to_string () const noexcept |
Returns a xtd::string that represents the current object. | |
Public Member Functions inherited from xtd::collections::generic::idictionary< key_t, value_t > | |
Public Member Functions inherited from xtd::collections::generic::ienumerable< xtd::collections::generic::key_value_pair< key_t, value_t > > | |
Public Member Functions inherited from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t > | |
Public Member Functions inherited from xtd::collections::generic::extensions::enumerable< enumerable_t, source_t > | |
source_t | aggregate (const std::function< source_t(const source_t &, const source_t &)> &func) const |
Applies an accumulator function over a sequence. | |
source_t | aggregate (const source_t &seed, const std::function< source_t(const source_t &, const source_t &)> &func) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. | |
template<typename accumulate_t > | |
accumulate_t | aggregate (const accumulate_t &seed, const std::function< accumulate_t(const source_t &, const accumulate_t &)> &func) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. | |
source_t | aggregate (const source_t &seed, const std::function< source_t(const source_t &, const source_t &)> &func, const std::function< source_t(const source_t &)> &result_selector) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. | |
template<typename result_t , typename accumulate_t > | |
result_t | aggregate (const accumulate_t &seed, const std::function< accumulate_t(const source_t &, const accumulate_t &)> &func, const std::function< result_t(const accumulate_t &)> &result_selector) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. | |
bool | all (const std::function< bool(const source_t &)> &predicate) const |
Determines whether all elements of a sequence satisfy a condition. | |
bool | any () const noexcept |
Determines whether a sequence contains any elements. | |
bool | any (const std::function< bool(const source_t &)> &predicate) const |
Determines whether any element of a sequence satisfies a condition. | |
const ienumerable< source_t > & | append (const source_t &element) const noexcept |
Appends a value to the end of the sequence. | |
const ienumerable< source_t > & | as_enumerable () const noexcept |
Returns the input typed as xtd::collection::generic::ienumerable <type_t>. | |
auto | average () const noexcept |
Computes the average of a sequence of source_t values. | |
template<typename result_t > | |
const ienumerable< result_t > & | cast () const noexcept |
Casts the elements of an xtd::collection::generic::ienumerable to the specified type. | |
const ienumerable< xtd::array< source_t > > & | chunk (size_t size) const |
Splits the elements of a sequence into chunks of size at most size. | |
const ienumerable< source_t > & | concat (const ienumerable< source_t > &second) const noexcept |
Concatenates two sequences. | |
bool | contains (const source_t &value) const noexcept |
Determines whether a sequence contains a specified element by using the default equality comparer. | |
bool | contains (const source_t &value, const xtd::collections::generic::iequality_comparer< source_t > &comparer) const noexcept |
Determines whether a sequence contains a specified element by using a specified equality comparer. | |
size_t | count () const noexcept |
Returns the number of elements in current sequence. | |
size_t | count (const std::function< bool(const source_t &)> &predicate) const noexcept |
Returns a number that represents how many elements in the specified sequence satisfy a condition. | |
template<typename key_t > | |
const ienumerable< key_value_pair< key_t, xtd::size > > & | count_by (const std::function< key_t(const source_t &)> &key_selector) const noexcept |
Returns the count of elements in the current sequence grouped by key. | |
template<typename key_t > | |
const ienumerable< key_value_pair< key_t, xtd::size > > & | count_by (const std::function< key_t(const source_t &)> &key_selector, const iequality_comparer< key_t > &key_comparer) const noexcept |
Returns the count of elements in the current sequence grouped by key. | |
const ienumerable< source_t > & | default_if_empty () const noexcept |
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty. | |
const ienumerable< source_t > & | default_if_empty (const source_t &default_value) const noexcept |
Returns the elements of the specified sequence or the specified value in a singleton collection if the current sequence is empty. | |
source_t | first_or_default (const std::function< bool(const source_t &)> &predicate, const source_t &default_value) const noexcept |
Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found. | |
source_t | first_or_default (const std::function< bool(const source_t &)> &predicate) const noexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. | |
source_t | first_or_default (const source_t default_value) const noexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. | |
source_t | first_or_default () const noexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. | |
template<typename result_t > | |
const ienumerable< result_t > & | select (const std::function< result_t(const source_t &)> &selector) const |
Projects each element of a sequence into a new form. | |
const ienumerable< source_t > & | select (const std::function< source_t(const source_t &)> &selector) const |
Projects each element of a sequence into a new form. | |
template<typename result_t > | |
const ienumerable< result_t > & | select (const std::function< result_t(const source_t &, size_t index)> &selector) const |
Projects each element of a sequence into a new form by incorporating the element's index. | |
const ienumerable< source_t > & | select (const std::function< source_t(const source_t &, size_t index)> &selector) const |
Projects each element of a sequence into a new form by incorporating the element's index. | |
const list< source_t > & | to_list () const noexcept |
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
const ienumerable< source_t > & | where (const std::function< bool(const source_t &)> &predicate) const |
Filters a sequence of values based on a predicate. | |
const ienumerable< source_t > & | where (const std::function< bool(const source_t &, size_t)> &predicate) const |
Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. | |
Static Public Member Functions inherited from xtd::object | |
template<typename object_a_t , typename object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<typename object_a_t , typename object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::key_type = typename xtd::collections::generic::idictionary<key_t, value_t>::key_type |
Represents the dictionary key type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::mapped_type = typename xtd::collections::generic::idictionary<key_t, value_t>::mapped_type |
Represents the dictionary mapped type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::value_type = typename xtd::collections::generic::idictionary<key_type, mapped_type>::value_type |
Represents the dictionary value type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::size_type = xtd::size |
Represents the dictionary size type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::difference_type = xtd::ptrdiff |
Represents the dictionary difference type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::hasher = hasher_t |
Represents the dictionary hasher type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::equator = equator_t |
Represents the dictionary equator type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::key_equal = equator_t |
Represents the dictionary equator type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::allocator_type = allocator_t |
Represents the dictionary allocator type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::base_value_type = std::pair<const key_t, value_t> |
Represents the dictionary base value type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::base_type = std::unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type> |
Represents the dictionary base type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::reference = value_type& |
Represents the dictionary reference type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::const_reference = const value_type& |
Represents the dictionary const reference type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::pointer = typename std::allocator_traits<allocator_t>::pointer |
Represents the dictionary pointer type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::const_pointer = typename std::allocator_traits<allocator_t>::const_pointer |
Represents the dictionary const pointer type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::iterator = typename xtd::collections::generic::idictionary<key_type, mapped_type>::iterator |
Represents the iterator of dictionary value type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::const_iterator = typename xtd::collections::generic::idictionary<key_type, mapped_type>::const_iterator |
Represents the const iterator of dictionary value type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::local_iterator = typename base_type::local_iterator |
Represents the local iterator of dictionary value type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::const_local_iterator = typename base_type::const_local_iterator |
Represents the const local iterator of dictionary value type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::node_type = typename base_type::node_type |
Represents the dictionary node type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::insert_return_type = typename base_type::insert_return_type |
Represents the dictionary insert return type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::key_collection = typename xtd::collections::generic::idictionary<key_type, mapped_type>::key_collection |
Represents the idictionary key collection type.
using xtd::collections::generic::dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >::value_collection = typename xtd::collections::generic::idictionary<key_type, mapped_type>::value_collection |
Represents the idictionary value collection type.
|
defaultnoexcept |
Initializes a new instance of the xtd::collections::generic::dictionary <key_t, value_t> class that is empty, has the default initial capacity, and uses the default equality comparer for the key type.
key_t
implements the xtd::equatable <type_t> generic interface, the default equality comparer uses that implementation. Alternatively, you can specify an implementation of the iequality_comparer <typer_t> generic interface by using a constructor that accepts a comparer parameter. This code example is part of a larger example provided for the xtd::collections::generic::dictionary <key_t, value_t> class.
|
inlineexplicitnoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
hash | Hash function to use. |
equal | Comparison function to use for all key comparisons of this container. |
alloc | Allocator to use for all memory allocations of this container. |
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
alloc | Allocator to use for all memory allocations of this container. |
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
hash | Hash function to use. |
alloc | Allocator to use for all memory allocations of this container. |
|
inlineexplicitnoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
alloc | Allocator to use for all memory allocations of this container. |
1.0
. For the default constructor, the number of buckets is implementation-defined.
|
inlineexplicitnoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
first | The fist iterator of the range [first, last) to copy the elements from. |
last | Thaae last itezrator of the range [first, last) to copy the elements from. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
hash | Hash function to use. |
equal | Comparison function to use for all key comparisons of this container. |
alloc | Allocator to use for all memory allocations of this container. |
1.0
. If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted (pending LWG2844.
|
inlineexplicitnoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
first | The fist iterator of the range [first, last) to copy the elements from. |
last | Thaae last itezrator of the range [first, last) to copy the elements from. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
alloc | Allocator to use for all memory allocations of this container. |
1.0
. If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted (pending LWG2844.
|
inlineexplicitnoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
first | The fist iterator of the range [first, last) to copy the elements from. |
last | Thaae last itezrator of the range [first, last) to copy the elements from. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
hash | Hash function to use. |
alloc | Allocator to use for all memory allocations of this container. |
1.0
. If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted (pending LWG2844.
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
other
, copies the load factor, the predicate, and the hash function as well. If alloc
is not provided, allocator is obtained by calling
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
alloc | Allocator to use for all memory allocations of this container. |
other
, copies the load factor, the predicate, and the hash function as well. If alloc
is not provided, allocator is obtained by calling
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
other
, copies the load factor, the predicate, and the hash function as well. If alloc
is not provided, allocator is obtained by calling
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
alloc | Allocator to use for all memory allocations of this container. |
other
, copies the load factor, the predicate, and the hash function as well. If alloc
is not provided, allocator is obtained by calling
|
defaultnoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
other
using move semantics. If alloc
is not provided, allocator is obtained by move-construction from the allocator belonging to other.
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
alloc | Allocator to use for all memory allocations of this container. |
other
using move semantics. If alloc
is not provided, allocator is obtained by move-construction from the allocator belonging to other.
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
other
using move semantics. If alloc
is not provided, allocator is obtained by move-construction from the allocator belonging to other.
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
other | Another container to be used as source to initialize the elements of the container with. |
alloc | Allocator to use for all memory allocations of this container. |
other
using move semantics. If alloc
is not provided, allocator is obtained by move-construction from the allocator belonging to other.
|
inlineexplicit |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
init | Initializer list to initialize the elements of the container with. |
hash | Hash function to use. |
equal | Comparison function to use for all key comparisons of this container. |
alloc | Allocator to use for all memory allocations of this container. |
|
inline |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
init | Initializer list to initialize the elements of the container with. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
alloc | Allocator to use for all memory allocations of this container. |
|
inlinenoexcept |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
init | Initializer list to initialize the elements of the container with. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
hash | Hash function to use. |
alloc | Allocator to use for all memory allocations of this container. |
|
inlineexplicit |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
init | Initializer list to initialize the elements of the container with. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
hash | Hash function to use. |
equal | Comparison function to use for all key comparisons of this container. |
alloc | Allocator to use for all memory allocations of this container. |
|
inline |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
init | Initializer list to initialize the elements of the container with. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
alloc | Allocator to use for all memory allocations of this container. |
|
inline |
Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources. Optionally uses user supplied bucket_count
as a minimal number of buckets to create, hash
as the hash function, equal
as the function to compare keys and alloc
as the allocator.
init | Initializer list to initialize the elements of the container with. |
bucket_count | Minimal number of buckets to use on initialization. If it is not specified, implementation-defined default value is used. |
hash | Hash function to use. |
alloc | Allocator to use for all memory allocations of this container. |
|
inlineoverridevirtualnoexcept |
Returns an iterator to the first element of the enumarable.
Reimplemented from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >.
|
inlineoverridevirtualnoexcept |
Returns an iterator to the first element of the enumarable.
Reimplemented from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >.
|
inlinenoexcept |
Gets the number of buckets in the container.
|
inlinenoexcept |
Gets the total numbers of elements the internal data structure can hold without resizing.
|
inlineoverridevirtualnoexcept |
Returns an iterator to the first element of the enumarable.
Reimplemented from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >.
|
inlineoverridevirtualnoexcept |
Returns an iterator to the element following the last element of the enumarable.
Reimplemented from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >.
|
inlinenoexcept |
Gets the number of key/value pairs contained in the xtd::collections::generic::dictionary <key_t, value_t>.
|
inlinenoexcept |
|
inlineoverridevirtualnoexcept |
Returns an iterator to the element following the last element of the enumarable.
Reimplemented from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >.
|
inlineoverridevirtualnoexcept |
Returns an iterator to the element following the last element of the enumarable.
Reimplemented from xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >.
|
inlinevirtualnoexcept |
Returns the underlying base type items.
|
inlinevirtualnoexcept |
Returns the underlying base type items.
|
inlineoverridevirtualnoexcept |
Gets a collection containing the keys in the xtd::collections::generic::dictionary <key_t, value_t>.
Implements xtd::collections::generic::idictionary< key_t, value_t >.
|
inline |
Gets the average number of elements per bucket, that is, xtd::collections::generic::dictionary::size divided by xtd::collections::generic::dictionary::bucket_count.
|
inlinenoexcept |
Gets the maximum number of buckets the container is able to hold due to system or library implementation limitations.
|
inline |
Gets the maximum load factor (number of elements per bucket). The container automatically increases the number of buckets if the load factor exceeds this threshold.
|
inline |
Sets the maximum load factor (number of elements per bucket). The container automatically increases the number of buckets if the load factor exceeds this threshold.
value | The new maximum load factor setting. |
|
inlinenoexcept |
Gets the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end())
for the largest container.
xtd::ptrdiff_object::max_value
or std::numeric_limits<difference_type>::max()
. At runtime, the size of the container may be limited to a value smaller than max_size() by the amount of RAM available.
|
inlinenoexcept |
Gets the number of key/value pairs contained in the xtd::collections::generic::dictionary <key_t, value_t>.
|
inlineoverridevirtualnoexcept |
Gets a collection containing the values in the xtd::collections::generic::dictionary <key_t, value_t>.
Implements xtd::collections::generic::idictionary< key_t, value_t >.
|
inlineoverridevirtual |
Adds an element with the provided key and value to the xtd::collections::generic::dictionary <key_t, value_t>.
key | The object to use as the key of the element to add. |
value | The object to use as the value of the element to add. |
xtd::argument_exception | An element with the same key already exists in the xtd::collections::generic::dictionary <key_t, value_t>. |
xtd::not_supported_exception | The xtd::collections::generic::dictionary <key_t, value_t> is read-only. |
operator []
to add new elements by setting the value of a key that does not exist in the dictionary; for example, my_collection["my_nonexistent_key"] = my_value
. However, if the specified key already exists in the dictionary, setting the operator []
overwrites the old value. In contrast, the xtd::collections::generic::dictionary::add method does not modify existing elements. Implements xtd::collections::generic::idictionary< key_t, value_t >.
|
inline |
Gets the element with the specified key.
key | The key of the element to get. |
xtd::collections::generic::key_not_found_exception | The property is retrieved and key is not found. |
xtd::not_supported_exception | The property is set and the xtd::collections::generic::dictionary <key_t, value_t> is read-only. |
|
inline |
Gets the element with the specified key.
key | The key of the element to get. |
xtd::collections::generic::key_not_found_exception | The property is retrieved and key is not found. |
xtd::not_supported_exception | The property is set and the xtd::collections::generic::dictionary <key_t, value_t> is read-only. |
|
inline |
Returns the index of the bucket for key key. Elements (if any) with keys equivalent to key are always found in this bucket.
key | The value of the key to examine. |
|
inlinenoexcept |
Returns the number of elements in the bucket with index n
.
n | The index of the bucket to examine. |
n
.
|
inlinenoexcept |
Erases all elements from the container. After this call, xtd::collections::generic::dictionary::size returns zero.
|
inlinenoexcept |
Returns the allocator associated with the container.
|
inlineoverridevirtualnoexcept |
Returns an enumerator that iterates through the xtd::collections::generic::dictionary <key_t, value_t>.
Implements xtd::collections::generic::ienumerable< xtd::collections::generic::key_value_pair< key_t, value_t > >.
|
inlinenoexcept |
Move assignment operator. Replaces the contents with a copy of the contents of other
.
other | Another container to use as data source. |
|
inlinenoexcept |
Move assignment operator. Replaces the contents with a copy of the contents of other
.
other | Another container to use as data source. |
|
defaultnoexcept |
Copy assignment operator. Replaces the contents with a copy of the contents of other
.
other | Another container to use as data source. |
|
inlinenoexcept |
Copy assignment operator. Replaces the contents with a copy of the contents of other
.
other | Another container to use as data source. |
|
inline |
Copy assignment operator. Replaces the contents with a copy of the contents of other
.
ilist | The initializer list to use as data source. |
|
inline |
Copy assignment operator. Replaces the contents with a copy of the contents of other
.
ilist | The initializer list to use as data source. |
|
inlineoverridevirtual |
Gets the element with the specified key.
key | The key of the element to get. |
xtd::collections::generic::key_not_found_exception | The property is retrieved and key is not found. |
xtd::not_supported_exception | The property is set and the xtd::collections::generic::dictionary <key_t, value_t> is read-only. |
my_collection[key]
. operator []
to add new elements by setting the value of a key that does not exist in the dictionary; for example, my_collection["my_nonexistent_key"] = my_value
. However, if the specified key already exists in the dictionary, setting the operator []
overwrites the old value. In contrast, the xtd::collections::generic::dictionary::add method does not modify existing elements. Implements xtd::collections::generic::idictionary< key_t, value_t >.
|
inlineoverridevirtual |
Sets the element with the specified key.
key | The key of the element to set. |
xtd::not_supported_exception | The property is set and the xtd::collections::generic::dictionary <key_t, value_t> is read-only. |
my_collection[key]
. operator []
to add new elements by setting the value of a key that does not exist in the dictionary; for example, my_collection["my_nonexistent_key"] = my_value
. However, if the specified key already exists in the dictionary, setting the operator []
overwrites the old value. In contrast, the xtd::collections::generic::dictionary::add method does not modify existing elements. Implements xtd::collections::generic::idictionary< key_t, value_t >.
|
inlinenoexcept |
Returns a reference to the underlying base type.
|
inlinenoexcept |
Returns a reference to the underlying base type.