xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t > Class Template Reference
Inheritance diagram for xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >:
xtd::object xtd::collections::generic::idictionary< key_t, value_t >

Definition

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
class xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >

Represents a collection of key/value pairs that are accessible by the key or index.

Definition
template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator <std::pair<const key_t, value_t>>>
Represents a generic collection of key/value pairs.
Definition idictionary.hpp:44
ordered_dictionary() noexcept=default
Initializes a new instance of the xtd::collections::generic::ordered_dictionary class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Header
#include <xtd/collections/generic/ordered_dictionary>
Namespace
xtd::collections::generic
Library
xtd.core

Public Aliases

using key_type
 Represents the dictionary key type.
 
using mapped_type
 Represents the dictionary mapped type.
 
using value_type
 Represents the dictionary value type.
 
using size_type
 Represents the dictionary size type.
 
using base_value_type
 Represents the dictionary base value type.
 
using base_type
 Represents the dictionary base type.
 
using list_type
 Represents the dictionary base type.
 
using key_collection
 Represents the idictionary key collection type.
 
using value_collection
 Represents the idictionary value collection type.
 

Public Constructors

 ordered_dictionary () noexcept=default
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary class.
 
 ordered_dictionary (const xtd::collections::generic::idictionary< key_t, value_t > &dictionary)
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::idictionary <key_t, value_t> and uses the default equality comparer for the key type.
 
 ordered_dictionary (const xtd::collections::generic::idictionary< key_t, value_t > &dictionary, const xtd::collections::generic::iequality_comparer< key_type > &comparer)
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::idictionary <key_t, value_t> and uses the default equality comparer for the key type, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.
 
 ordered_dictionary (const xtd::collections::generic::ienumerable< value_type > &collection)
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::ienumerable <type_t>.
 
 ordered_dictionary (const xtd::collections::generic::ienumerable< value_type > &collection, const xtd::collections::generic::iequality_comparer< key_type > &comparer)
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::ienumerable <type_t>, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.
 
 ordered_dictionary (size_t capacity)
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that is empty, has the specified initial capacit.
 
 ordered_dictionary (size_t capacity, const xtd::collections::generic::iequality_comparer< key_type > &comparer)
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that is empty, has the specified initial capacit, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.
 
 ordered_dictionary (const xtd::collections::generic::iequality_comparer< key_type > &comparer)
 Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that is empty, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.
 
template<class input_iterator_t>
 ordered_dictionary (input_iterator_t first, input_iterator_t last)
 Initializes instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class from a variety of data sources.
 
 ordered_dictionary (const ordered_dictionary &other) noexcept
 Initializes instance of the xtd::collections::generic::ordered_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.
 
 ordered_dictionary (ordered_dictionary &&other) noexcept=default
 Initializes instance of the xtd::collections::generic::ordered_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.
 
 ordered_dictionary (std::initializer_list< base_value_type > init)
 
template<class init_key_t, class init_value_t>
 ordered_dictionary (std::initializer_list< key_value_pair< init_key_t, init_value_t > > init)
 Initializes instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class from a variety of data sources.
 

Public Properties

auto count () const noexcept -> size_type override
 Gets the number of key/value pairs contained in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto comparer () const noexcept -> const iequality_comparer< key_t > &
 Gets the xtd::collections::generic::iequality_comparer <type_t> that is used to determine equality of keys for the dictionary.
 
virtual auto items () const noexcept -> const base_type &
 Returns the underlying base type items.
 
virtual auto items () noexcept -> base_type &
 Returns the underlying base type items.
 
auto keys () const noexcept -> key_collection override
 Gets a collection containing the keys in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto values () const noexcept -> value_collection override
 Gets a collection containing the values in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 

Public Methods

auto add (const key_t &key, const value_t &value) -> void override
 Adds an element with the provided key and value to the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto add (const value_type &item) -> void override
 Adds an item to the xtd::collections::generic::icollection <type_t>.
 
auto clear () noexcept -> void override
 Removes all keys and values from the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto contains (const value_type &item) const noexcept -> bool override
 Determines whether an element is in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto contains_key (const key_t &key) const noexcept -> bool override
 Determines whether the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains the specified key.
 
auto contains_value (const value_t &value) const noexcept -> bool
 Determines whether the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains the specified value.
 
auto copy_to (xtd::array< value_type > &array, xtd::size array_index) const -> void override
 Copies the elements of the xtd::collections::generic::icollection <type_t> to an xtd::array, starting at a particular xtd::array index.
 
xtd::collections::generic::enumerator< value_typeget_enumerator () const noexcept override
 Returns an enumerator that iterates through the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto insert (xtd::size index, const key_t &key) -> void
 Inserts a new entry into the xtd::collections::generic::ordered_dictionary collection with the specified key at the specified index.
 
auto insert (xtd::size index, const key_t &key, const value_t &value) -> void
 Inserts a new entry into the xtd::collections::generic::ordered_dictionary collection with the specified key and value at the specified index.
 
auto remove (const key_t &key) noexcept -> bool override
 Removes the value with the specified key from the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto remove (const value_type &item) noexcept -> bool override
 Removes the first occurrence of a specific object from the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
 
auto remove_at (xtd::size index) -> void
 Removes the entry at the specified index from the OrderedDictionary collection.
 
auto to_string () const noexcept -> xtd::string override
 Gets a string that represents the current object.
 
auto try_get_value (const key_t &key, value_t &value) const -> bool override
 Gets the value associated with the specified key.
 

Public Operators

auto operator= (ordered_dictionary &&other) noexcept -> ordered_dictionary &=default
 Move assignment operator. Replaces the contents with a copy of the contents of other.
 
auto operator= (const ordered_dictionary &other) noexcept -> ordered_dictionary &
 Copy assignment operator. Replaces the contents with a copy of the contents of other.
 
auto operator= (std::initializer_list< base_value_type > ilist) -> ordered_dictionary &
 Copy assignment operator. Replaces the contents with a copy of the contents of other.
 
template<class init_key_t, class init_value_t>
auto operator= (std::initializer_list< key_value_pair< init_key_t, init_value_t > > ilist) -> ordered_dictionary &
 Copy assignment operator. Replaces the contents with a copy of the contents of other.
 
auto operator() (xtd::size index) const -> const value_t &
 Gets the value at the specified index.
 
auto operator() (xtd::size index) -> value_t &
 Sets the value at the specified index.
 
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

using key_type
 Represents the dictionary key type.
 
using mapped_type
 Represents the dictionary mapped type.
 
using value_type
 Represents the xtd::collections::generic::idictionary value type.
 
using iterator
 Represents the iterator of xtd::collections::generic::ienumerable value type.
 
using const_iterator
 Represents the const iterator of xtd::collections::generic::ienumerable value type.
 
using key_collection
 Represents the idictionary key collection type.
 
using value_collection
 Represents the idictionary value collection type.
 
 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 xtd::size 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<class object_t>
xtd::unique_ptr_object< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
template<class object_a_t, class 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<class object_a_t, class 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.
 

Member Typedef Documentation

◆ key_type

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::key_type

Represents the dictionary key type.

◆ mapped_type

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::mapped_type

Represents the dictionary mapped type.

◆ value_type

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::value_type

Represents the dictionary value type.

◆ size_type

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::size_type

Represents the dictionary size type.

◆ base_value_type

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::base_value_type

Represents the dictionary base value type.

◆ base_type

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::base_type

Represents the dictionary base type.

◆ list_type

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::list_type

Represents the dictionary base type.

◆ key_collection

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::key_collection

Represents the idictionary key collection type.

◆ value_collection

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
using xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::value_collection

Represents the idictionary value collection type.

Constructor & Destructor Documentation

◆ ordered_dictionary() [1/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( )
defaultnoexcept

Initializes a new instance of the xtd::collections::generic::ordered_dictionary class.

Examples
The following code example demonstrates the creation and population of an xtd::collections::generic::ordered_dictionary collection. This code is part of a larger code example that can be viewed at xtd::collections::generic::ordered_dictionary.
// Creates and initializes a ordered_dictionary.
auto my_ordered_dictionary = ordered_dictionary<string, string> {};
my_ordered_dictionary.add("test_key1", "test_value1");
my_ordered_dictionary.add("test_key2", "test_value2");
my_ordered_dictionary.add("key_to_delete", "value_to_delete");
my_ordered_dictionary.add("test_key3", "test_value3");
// Display the contents using the key and value collections
display_contents(my_ordered_dictionary.keys(), my_ordered_dictionary.values(), my_ordered_dictionary.count());
Remarks
The comparer determines whether two keys are equal. Every key in a xtd::collections::generic::ordered_dictionary collection must be unique. The default comparer is the key's implementation of '==' operator.

◆ ordered_dictionary() [2/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( const xtd::collections::generic::idictionary< key_t, value_t > & dictionary)
inline

Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::idictionary <key_t, value_t> and uses the default equality comparer for the key type.

Parameters
dictionaryThe xtd::collections::generic::idictionary <key_t, value_t> whose elements are copied to the new xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Exceptions
xtd::argument_exception`dictionary` contains one or more duplicate keys.
Remarks
Every key in a xtd::collections::generic::ordered_dictionary <key_t, value_t> must be unique according to the default equality comparer; likewise, every key in the source dictionary must also be unique according to the default equality comparer.
The initial capacity of the new xtd::collections::generic::ordered_dictionary <key_t, value_t> is large enough to contain all the elements in dictionary.
xtd::collections::generic::ordered_dictionary <key_t, value_t> requires an equality implementation to determine whether keys are equal. This constructor uses the default generic equality comparer, xtd::collections::generic::equality_comparer::default_equality_comparer. If type key_t implements the xtd::iequatable <type_t> generic interface, the default equality comparer uses that implementation. Alternatively, you can specify an implementation of the xtd::collections::generic::iequality_comparer <type_t> generic interface by using a constructor that accepts a comparer parameter.
This constructor is an O(n) operation, where n is the number of elements in dictionary.

◆ ordered_dictionary() [3/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( const xtd::collections::generic::idictionary< key_t, value_t > & dictionary,
const xtd::collections::generic::iequality_comparer< key_type > & comparer )
inline

Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::idictionary <key_t, value_t> and uses the default equality comparer for the key type, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.

Parameters
dictionaryThe xtd::collections::generic::idictionary <key_t, value_t> whose elements are copied to the new xtd::collections::generic::ordered_dictionary <key_t, value_t>.
comparerThe xtd::collections::generic::iequality_comparer <key_type> implementation to use when comparing keys.
Exceptions
xtd::argument_exception`dictionary` contains one or more duplicate keys.
Remarks
Every key in a xtd::collections::generic::ordered_dictionary <key_t, value_t> must be unique according to the default equality comparer; likewise, every key in the source dictionary must also be unique according to the default equality comparer.
The initial capacity of the new xtd::collections::generic::ordered_dictionary <key_t, value_t> is large enough to contain all the elements in dictionary.
xtd::collections::generic::ordered_dictionary <key_t, value_t> requires an equality implementation to determine whether keys are equal. This constructor uses the default generic equality comparer, xtd::collections::generic::equality_comparer::default_equality_comparer. If type key_t implements the xtd::iequatable <type_t> generic interface, the default equality comparer uses that implementation. Alternatively, you can specify an implementation of the xtd::collections::generic::iequality_comparer <type_t> generic interface by using a constructor that accepts a comparer parameter.
This constructor is an O(n) operation, where n is the number of elements in dictionary.

◆ ordered_dictionary() [4/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( const xtd::collections::generic::ienumerable< value_type > & collection)
inline

Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::ienumerable <type_t>.

Parameters
collectionThe xtd::collections::generic::ienumerable <type_t> whose elements are copied to the new xtd::collections::generic::ordered_dictionary <key_t, value_t>
Exceptions
xtd::argument_exception`dictionary` contains one or more duplicate keys.

◆ ordered_dictionary() [5/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( const xtd::collections::generic::ienumerable< value_type > & collection,
const xtd::collections::generic::iequality_comparer< key_type > & comparer )
inline

Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that contains elements copied from the specified xtd::collections::generic::ienumerable <type_t>, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.

Parameters
collectionThe xtd::collections::generic::ienumerable <type_t> whose elements are copied to the new xtd::collections::generic::ordered_dictionary <key_t, value_t>
comparerThe xtd::collections::generic::iequality_comparer <key_type> implementation to use when comparing keys.
Exceptions
xtd::argument_exception`dictionary` contains one or more duplicate keys.

◆ ordered_dictionary() [6/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( size_t capacity)
inline

Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that is empty, has the specified initial capacit.

Parameters
capacityThe initial number of elements that the xtd::collections::generic::ordered_dictionary <key_t, value_t> can contain.
Remarks
Every key in a xtd::collections::generic::ordered_dictionary <key_t, value_t> must be unique according to the specified comparer; likewise, every key in the source dictionary must also be unique according to the specified comparer.
The capacity of a xtd::collections::generic::ordered_dictionary <key_t, value_t> is the number of elements that can be added to the xtd::collections::generic::ordered_dictionary <key_t, value_t> before resizing is necessary. As elements are added to a xtd::collections::generic::ordered_dictionary <key_t, value_t>, the capacity is automatically increased as required by reallocating the internal array.
If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
xtd::collections::generic::ordered_dictionary <key_t, value_t> requires an equality implementation to determine whether keys are equal. If type TKey implements the xtd::iequatable <type_t> generic interface, the default equality comparer uses that implementation.
This constructor is an O(1) operation.
xtd::collections::generic::ordered_dictionary::capacity and xtd::collections::generic::ordered_dictionary::bucket_count are equivalent properties.

◆ ordered_dictionary() [7/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( size_t capacity,
const xtd::collections::generic::iequality_comparer< key_type > & comparer )
inline

Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that is empty, has the specified initial capacit, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.

Parameters
capacityThe initial number of elements that the xtd::collections::generic::ordered_dictionary <key_t, value_t> can contain.
comparerThe xtd::collections::generic::iequality_comparer <key_type> implementation to use when comparing keys.
Remarks
Every key in a xtd::collections::generic::ordered_dictionary <key_t, value_t> must be unique according to the specified comparer; likewise, every key in the source dictionary must also be unique according to the specified comparer.
The capacity of a xtd::collections::generic::ordered_dictionary <key_t, value_t> is the number of elements that can be added to the xtd::collections::generic::ordered_dictionary <key_t, value_t> before resizing is necessary. As elements are added to a xtd::collections::generic::ordered_dictionary <key_t, value_t>, the capacity is automatically increased as required by reallocating the internal array.
If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
xtd::collections::generic::ordered_dictionary <key_t, value_t> requires an equality implementation to determine whether keys are equal. If type TKey implements the xtd::iequatable <type_t> generic interface, the default equality comparer uses that implementation.
This constructor is an O(1) operation.
xtd::collections::generic::ordered_dictionary::capacity and xtd::collections::generic::ordered_dictionary::bucket_count are equivalent properties.

◆ ordered_dictionary() [8/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( const xtd::collections::generic::iequality_comparer< key_type > & comparer)
inline

Initializes a new instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class that is empty, and uses the specified xtd::collections::generic::iequality_comparer <key_type>.

Parameters
comparerThe xtd::collections::generic::iequality_comparer <key_type> implementation to use when comparing keys.
Remarks
Every key in a xtd::collections::generic::ordered_dictionary <key_t, value_t> must be unique according to the specified comparer; likewise, every key in the source dictionary must also be unique according to the specified comparer.
The capacity of a xtd::collections::generic::ordered_dictionary <key_t, value_t> is the number of elements that can be added to the xtd::collections::generic::ordered_dictionary <key_t, value_t> before resizing is necessary. As elements are added to a xtd::collections::generic::ordered_dictionary <key_t, value_t>, the capacity is automatically increased as required by reallocating the internal array.
If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
xtd::collections::generic::ordered_dictionary <key_t, value_t> requires an equality implementation to determine whether keys are equal. If type TKey implements the xtd::iequatable <type_t> generic interface, the default equality comparer uses that implementation.
This constructor is an O(1) operation.
xtd::collections::generic::ordered_dictionary::capacity and xtd::collections::generic::ordered_dictionary::bucket_count are equivalent properties.

◆ ordered_dictionary() [9/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
template<class input_iterator_t>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( input_iterator_t first,
input_iterator_t last )
inlineexplicit

Initializes instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class from a variety of data sources.

Parameters
firstThe fist iterator of the range [first, last) to copy the elements from.
lastThaae last itezrator of the range [first, last) to copy the elements from.
Exceptions
xtd::argument_exception`dictionary` contains one or more duplicate keys.
Remarks
Constructs the container with the contents of the range [first, last). Sets xtd::collections::generic::ordered_dictionary::max_load_factor() to 1.0. If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted (pending LWG2844.
xtd::collections::generic::ordered_dictionary::bucket_count and xtd::collections::generic::ordered_dictionary::capacity are equivalent properties.

◆ ordered_dictionary() [10/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( const ordered_dictionary< key_t, value_t, allocator_t > & other)
inlinenoexcept

Initializes instance of the xtd::collections::generic::ordered_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.

Parameters
otherAnother container to be used as source to initialize the elements of the container with.
Remarks
Copy constructor. Constructs the container with the copy of the contents of other, copies the load factor, the predicate, and the hash function as well. If alloc is not provided, allocator is obtained by calling

◆ ordered_dictionary() [11/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( ordered_dictionary< key_t, value_t, allocator_t > && other)
defaultnoexcept

Initializes instance of the xtd::collections::generic::ordered_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.

Parameters
otherAnother container to be used as source to initialize the elements of the container with.
Remarks
Move constructor. Constructs the container with the contents of other using move semantics. If alloc is not provided, allocator is obtained by move-construction from the allocator belonging to other.

◆ ordered_dictionary() [12/12]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
template<class init_key_t, class init_value_t>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::ordered_dictionary ( std::initializer_list< key_value_pair< init_key_t, init_value_t > > init)
inlineexplicit

Initializes instance of the xtd::collections::generic::ordered_dictionary <key_t, value_t> class from a variety of data sources.

Parameters
initInitializer list to initialize the elements of the container with.
Exceptions
xtd::argument_exception`dictionary` contains one or more duplicate keys.
Remarks
Initializer-list constructor. Constructs the container with the contents of the initializer list init, same as
dictionary(init.begin(), init.end())
Represents a collection of keys and values.
Definition dictionary.hpp:67

Member Function Documentation

◆ count()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::count ( ) const -> size_type
inlineoverridenoexcept

Gets the number of key/value pairs contained in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Returns
the number of key/value pairs contained in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Remarks
The capacity of a xtd::collections::generic::ordered_dictionary <key_t, value_t> is the number of elements that the xtd::collections::generic::ordered_dictionary <key_t, value_t> can store. The xtd::collections::generic::ordered_dictionary::count property is the number of elements that are actually in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
The capacity is always greater than or equal to xtd::collections::generic::ordered_dictionary::count. If xtd::collections::generic::ordered_dictionary::count exceeds the capacity while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.
Getting the value of this property is an O(1) operation.

◆ comparer()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::comparer ( ) const -> const iequality_comparer < key_t >&
inlinenoexcept

Gets the xtd::collections::generic::iequality_comparer <type_t> that is used to determine equality of keys for the dictionary.

Returns
The xtd::collections::generic::iequality_comparer <type_t> generic interface implementation that is used to determine equality of keys for the current xtd::collections::generic::dictionary <key_t, value_t> and to provide hash values for the keys.
Remarks
xtd::collections::generic::dictionary <key_t, value_t> requires an equality implementation to determine whether keys are equal. You can specify an implementation of the xtd::collections::generic::iequality_comparer <type_t> generic interface by using a constructor that accepts a comparer parameter; if you do not specify one, the default generic equality comparer td::collections::generic::equality_comparer::default_equality_comparer is used.

◆ items() [1/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
virtual auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::items ( ) const -> const base_type&
inlinevirtualnoexcept

Returns the underlying base type items.

Returns
The underlying base type items.

◆ items() [2/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
virtual auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::items ( ) -> base_type&
inlinevirtualnoexcept

Returns the underlying base type items.

Returns
The underlying base type items.

◆ keys()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::keys ( ) const -> key_collection
inlineoverridevirtualnoexcept

Gets a collection containing the keys in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Returns
A xtd::collections::generic::ordered_dictionary::key_collection containing the keys in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Remarks
The order of the keys in the xtd::collections::generic::ordered_dictionary::key_collection is unspecified, but it is the same order as the associated values in the xtd::collections::generic::ordered_dictionary::value_collection returned by the xtd::collections::generic::ordered_dictionary::values property.
Getting the value of this property is an O(1) operation.

Implements xtd::collections::generic::idictionary< key_t, value_t >.

◆ values()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::values ( ) const -> value_collection
inlineoverridevirtualnoexcept

Gets a collection containing the values in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Returns
A xtd::collections::generic::ordered_dictionary::value_collection containing the values in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Remarks
The order of the values in the xtd::collections::generic::ordered_dictionary::value_collection is unspecified, but it is the same order as the associated keys in the xtd::collections::generic::ordered_dictionary::key_collection returned by the xtd::collections::generic::ordered_dictionary::keys property.
Getting the value of this property is an O(1) operation.

Implements xtd::collections::generic::idictionary< key_t, value_t >.

◆ add() [1/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::add ( const key_t & key,
const value_t & value ) -> void
inlineoverridevirtual

Adds an element with the provided key and value to the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Parameters
keyThe object to use as the key of the element to add.
valueThe object to use as the value of the element to add.
Exceptions
xtd::argument_exceptionAn element with the same key already exists in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
xtd::not_supported_exceptionThe xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.
Remarks
You can also use the 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::ordered_dictionary::add method does not modify existing elements.

Implements xtd::collections::generic::idictionary< key_t, value_t >.

◆ add() [2/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::add ( const value_type & item) -> void
inlineoverride

Adds an item to the xtd::collections::generic::icollection <type_t>.

Parameters
itemThe object to add to the xtd::collections::generic::icollection <type_t>.
Exceptions
xtd::not_supported_exceptionThe xtd::collections::generic::icollection <type_t> is read-only.

◆ clear()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::clear ( ) -> void
inlineoverridenoexcept

Removes all keys and values from the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Remarks
The xtd::collections::generic::ordered_dictionary::count property is set to 0, and references to other objects from elements of the collection are also released. The capacity remains unchanged.

◆ contains()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::contains ( const value_type & item) const -> bool
inlineoverridenoexcept

Determines whether an element is in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Parameters
itemThe object to be added to the end of the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Returns
true if the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains an element with the specified item ; otherwise, false.

◆ contains_key()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::contains_key ( const key_t & key) const -> bool
inlineoverridevirtualnoexcept

Determines whether the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains the specified key.

Parameters
Thekey to locate in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Returns
true if the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains an element with the specified key ; otherwise, false.
Remarks
This method approaches an O(1) operation.

Implements xtd::collections::generic::idictionary< key_t, value_t >.

◆ contains_value()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::contains_value ( const value_t & value) const -> bool
inlinenoexcept

Determines whether the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains the specified value.

Parameters
Thevalue to locate in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Returns
true if the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains an element with the specified key ; otherwise, false.
Remarks
This method performs a linear search; therefore, the average execution time is proportional to xtd::collections::generic::ordered_dictionary::count. That is, this method is an O(n) operation, where n is xtd::collections::generic::ordered_dictionary::count.

◆ copy_to()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::copy_to ( xtd::array< value_type > & array,
xtd::size array_index ) const -> void
inlineoverride

Copies the elements of the xtd::collections::generic::icollection <type_t> to an xtd::array, starting at a particular xtd::array index.

Parameters
arrayThe one-dimensional xtd::array that is the destination of the elements copied from xtd::collections::generic::icollection <type_t>. The xtd::array must have zero-based indexing.
array_indexThe zero-based index in array at which copying begins.
Exceptions
xtd::argument_exceptionThe number of elements in the source xtd::collections::generic::icollection <type_t> is greater than the available space from `array_index` to the end of the destination `array`.

◆ get_enumerator()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::enumerator< value_type > xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::get_enumerator ( ) const
inlineoverridenoexcept

Returns an enumerator that iterates through the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Returns
A xtd::collections::enumerator structure for the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

◆ insert() [1/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::insert ( xtd::size index,
const key_t & key ) -> void
inline

Inserts a new entry into the xtd::collections::generic::ordered_dictionary collection with the specified key at the specified index.

Parameters
indexThe zero-based index at which the element should be inserted.
keyThe key of the entry to add.
Exceptions
xtd::argument_out_of_rangeindex is out of range.
xtd::not_supported_exceptionThe property is set and the xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.

◆ insert() [2/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::insert ( xtd::size index,
const key_t & key,
const value_t & value ) -> void
inline

Inserts a new entry into the xtd::collections::generic::ordered_dictionary collection with the specified key and value at the specified index.

Parameters
indexThe zero-based index at which the element should be inserted.
keyThe key of the entry to add.
valueThe value of the entry to add.
Exceptions
xtd::argument_out_of_rangeindex is out of range.
xtd::not_supported_exceptionThe property is set and the xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.

◆ remove() [1/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::remove ( const key_t & key) -> bool
inlineoverridevirtualnoexcept

Removes the value with the specified key from the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Parameters
keyThe key of the element to remove.
Returns
true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Remarks
If the xtd::collections::generic::ordered_dictionary <key_t, value_t> does not contain an element with the specified key, the xtd::collections::generic::ordered_dictionary <key_t, value_t> remains unchanged. No exception is thrown.

Implements xtd::collections::generic::idictionary< key_t, value_t >.

◆ remove() [2/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::remove ( const value_type & item) -> bool
inlineoverridenoexcept

Removes the first occurrence of a specific object from the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

Parameters
itemThe object to remove from the xtd::collections::generic::ordered_dictionary <key_t, value_t>.
Returns
true if item is successfully removed; otherwise, false. This method also returns false if item value was not found in the xtd::collections::generic::ordered_dictionary <key_t, value_t>.

◆ remove_at()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::remove_at ( xtd::size index) -> void
inline

Removes the entry at the specified index from the OrderedDictionary collection.

Parameters
indexThe zero-based index of the entry to remove.
Exceptions
xtd::argument_out_of_rangeindex is out of range.
xtd::not_supported_exceptionThe property is set and the xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.
Remarks
The entries that follow the removed entry move up to occupy the vacated spot and the indexes of the entries that move are also updated.

◆ to_string()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::to_string ( ) const -> xtd::string
inlineoverridevirtualnoexcept

Gets a string that represents the current object.

Returns
A string that represents the current object.

Reimplemented from xtd::object.

◆ try_get_value()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::try_get_value ( const key_t & key,
value_t & value ) const -> bool
inlineoverridevirtual

Gets the value associated with the specified key.

Parameters
keyThe key of the value to get.
valueWhen this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.
Returns
true if the xtd::collections::generic::ordered_dictionary <key_t, value_t> contains an element with the specified key; otherwise, false.

Implements xtd::collections::generic::idictionary< key_t, value_t >.

◆ operator=() [1/4]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator= ( ordered_dictionary< key_t, value_t, allocator_t > && other) -> ordered_dictionary &=default
defaultnoexcept

Move assignment operator. Replaces the contents with a copy of the contents of other.

Parameters
otherAnother container to use as data source.
Returns
This current instance.

◆ operator=() [2/4]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator= ( const ordered_dictionary< key_t, value_t, allocator_t > & other) -> ordered_dictionary&
inlinenoexcept

Copy assignment operator. Replaces the contents with a copy of the contents of other.

Parameters
otherAnother container to use as data source.
Returns
This current instance.

◆ operator=() [3/4]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator= ( std::initializer_list< base_value_type > ilist) -> ordered_dictionary&
inline

Copy assignment operator. Replaces the contents with a copy of the contents of other.

Parameters
ilistThe initializer list to use as data source.
Returns
This current instance.

◆ operator=() [4/4]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
template<class init_key_t, class init_value_t>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator= ( std::initializer_list< key_value_pair< init_key_t, init_value_t > > ilist) -> ordered_dictionary&
inline

Copy assignment operator. Replaces the contents with a copy of the contents of other.

Parameters
ilistThe initializer list to use as data source.
Returns
This current instance.

◆ operator()() [1/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator() ( xtd::size index) const -> const value_t&
inline

Gets the value at the specified index.

Parameters
indexThe zero-based index of the value to get or set.
Returns
The value of the item at the specified index.
Exceptions
xtd::argument_out_of_rangeindex is out of range.
xtd::collections::generic::key_not_found_exceptionThe property is retrieved and key is not found.
xtd::not_supported_exceptionThe property is set and the xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.
Remarks
This property allows you to access a specific element in the collection by using the following syntax: my_collection[index].

◆ operator()() [2/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
auto xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator() ( xtd::size index) -> value_t&
inline

Sets the value at the specified index.

Parameters
indexThe zero-based index of the value to get or set.
Returns
The value of the item at the specified index.
Exceptions
xtd::argument_out_of_rangeindex is out of range.
xtd::collections::generic::key_not_found_exceptionThe property is retrieved and key is not found.
xtd::not_supported_exceptionThe property is set and the xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.
Remarks
This property allows you to access a specific element in the collection by using the following syntax: my_collection[index].

◆ operator[]() [1/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
const value_t & xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator[] ( const key_t & key) const
inlineoverride

Gets the element with the specified key.

Parameters
keyThe key of the element to get.
Returns
The element with the specified key.
Exceptions
xtd::collections::generic::key_not_found_exceptionThe property is retrieved and key is not found.
xtd::not_supported_exceptionThe property is set and the xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.
Remarks
This property provides the ability to access a specific element in the collection by using the following syntax: my_collection[key].
You can also use the 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::ordered_dictionary::add method does not modify existing elements.

◆ operator[]() [2/2]

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
value_t & xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator[] ( const key_t & key)
inlineoverridevirtual

Sets the element with the specified key.

Parameters
keyThe key of the element to set.
Returns
The element with the specified key.
Exceptions
xtd::not_supported_exceptionThe property is set and the xtd::collections::generic::ordered_dictionary <key_t, value_t> is read-only.
Remarks
This property provides the ability to access a specific element in the collection by using the following syntax: my_collection[key].
You can also use the 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::ordered_dictionary::add method does not modify existing elements.

Implements xtd::collections::generic::idictionary< key_t, value_t >.

◆ operator const base_type &()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator const base_type & ( ) const
inlinenoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

◆ operator base_type &()

template<class key_t, class value_t, class allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
xtd::collections::generic::ordered_dictionary< key_t, value_t, allocator_t >::operator base_type & ( )
inlinenoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

The documentation for this class was generated from the following file: