template<typename key_t, typename value_t, typename hasher_t = xtd::collections::generic::helpers::hasher<key_t>, typename equator_t = xtd::collections::generic::helpers::equator<key_t>, typename allocator_t = xtd::collections::generic::helpers::allocator<std::pair<const key_t, value_t>>>
class xtd::collections::concurrent::concurrent_dictionary< key_t, value_t, hasher_t, equator_t, allocator_t >
Represents a thread-safe collection of key/value pairs that can be accessed by multiple threads concurrently.
- Definition
template<typename type_t>
Represents a thread-safe collection of key/value pairs that can be accessed by multiple threads concu...
Definition concurrent_dictionary.hpp:37
concurrent_dictionary()=default
Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:40
- Header
#include <xtd/collections/concurrent/concurrent_dictionary>
- Namespace
- xtd::collections::concurrent
- Library
- xtd.core
- Examples
- The following example shows how to construct a xtd::collections::concurrent::concurrent_dictionary <key_t, value_t> object.
#include <xtd/xtd>
class example {
public:
static auto main() {
auto HIGHNUMBER = 64;
auto initial_capacity = 101_z;
auto concurrency_level = num_procs * 2;
for (
auto i = 1;
i <= HIGHNUMBER; ++
i)
cd[i] = i * i;
}
};
static auto write_line() -> void
Writes the current line terminator to the standard output stream using the specified format informati...
static auto processor_count() -> xtd::usize
Gets the number of processors on the current machine.
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:152
@ i
The I key.
Definition console_key.hpp:104
Provides several thread-safe collection classes that should be used in place of the corresponding typ...
Definition concurrent_bag.hpp:20
|
| | concurrent_dictionary ()=default |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that is empty, has the default concurrency level, has the default initial capacity, and uses the default comparer for the key type.
|
| | concurrent_dictionary (xtd::collections::generic::ienumerable< value_type > &&collection) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that contains elements copied from the specified xtd::collections::generic::ienumerable<value_type>, has the default concurrency level, has the default initial capacity, and uses the default comparer for the key type.
|
| | concurrent_dictionary (xtd::iterable auto &&collection) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that contains elements copied from the specified xtd::iterable, has the default concurrency level, has the default initial capacity, and uses the default comparer for the key type.
|
| | concurrent_dictionary (const xtd::collections::generic::iequality_comparer< key_type > &comparercomparer) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that is empty, has the default concurrency level and capacity, and uses the specified xtd::collections::generic::iequality_comparer<key_type>.
|
| | concurrent_dictionary (xtd::collections::generic::ienumerable< value_type > &&collection, const xtd::collections::generic::iequality_comparer< key_type > &comparercomparer) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that contains elements copied from the specified xtd::collections::generic::ienumerable has the default concurrency level, has the default initial capacity, and uses the specified xtd::collections::generic::iequality_comparer<key_type>.
|
| | concurrent_dictionary (xtd::iterable auto &&collection, const xtd::collections::generic::iequality_comparer< key_type > &comparercomparer) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that contains elements copied from the specified xtd::iterable has the default concurrency level, has the default initial capacity, and uses the specified xtd::collections::generic::iequality_comparer<key_type>.
|
| | concurrent_dictionary (xtd::usize concurrent_level, xtd::usize capacity) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that is empty, has the specified concurrency level and capacity, and uses the default comparer for the key type.
|
| | concurrent_dictionary (xtd::usize concurrent_level, xtd::collections::generic::ienumerable< value_type > &&collection, const xtd::collections::generic::iequality_comparer< key_type > &comparercomparer) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that contains elements copied from the specified xtd::collections::generic::ienumerable, and uses the specified xtd::collections::generic::iequality_comparer<key_type>.
|
| | concurrent_dictionary (xtd::usize concurrent_level, xtd::iterable auto &&collection, const xtd::collections::generic::iequality_comparer< key_type > &comparercomparer) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that contains elements copied from the specified xtd::iterable, and uses the specified xtd::collections::generic::iequality_comparer<key_type>.
|
| | concurrent_dictionary (xtd::usize concurrent_level, xtd::usize capacity, const xtd::collections::generic::iequality_comparer< key_type > &comparercomparer) |
| | Initializes a new instance of the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> class that is empty, has the specified concurrency level and capacity, and uses the specified xtd::collections::generic::iequality_comparer<key_type>.
|
| | concurrent_dictionary (std::initializer_list< std::pair< key_t, value_t > > items) |
| | Initializes instance of the xtd::collections::generic::dictionary <key_t, value_t> class from a variety of data sources.
|
| | concurrent_dictionary (std::initializer_list< value_type > items) |
| | Constructs the container with the contents of the specified initializer list, and allocator.
|
|
| auto | add_or_update (const key_t &key, xtd::callable< value_t, key_t > auto &&add_value_factory, xtd::callable< value_t, key_t, value_t > auto &&update_value_factory) -> const value_t & |
| | Uses the specified functions to add a key/value pair to the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> if the key does not already exist, or to update a key/value pair in the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> if the key already exists.
|
| auto | add_or_update (const key_t &key, const value_t &add_value, xtd::callable< value_t, key_t, value_t > auto &&update_value_factory) -> const value_t & |
| | Adds a key/value pair to the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> if the key does not already exist, or updates a key/value pair in the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> by using the specified function if the key already exists.
|
| template<typename arg_t> |
| auto | add_or_update (const key_t &key, xtd::callable< value_t, key_t, arg_t > auto &&add_value_factory, xtd::callable< value_t, key_t, value_t, arg_t > auto &&update_value_factory, arg_t &&factory_argument) -> const value_t & |
| | Uses the specified functions and argument to add a key/value pair to the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> if the key does not already exist, or to update a key/value pair in the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> if the key already exists.
|
| auto | clear () -> void override |
| | Removes all keys and values from the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t>.
|
| auto | contains_key (const key_t &key) const noexcept -> bool override |
| | Determines whether the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t> contains the specified key.
|
| auto | copy_to (xtd::array< value_type > &array, xtd::usize array_index) const -> void override |
| | Copies the elements of the xtd::collections::concurrent::concurrent_dictionary <key_t, value_t> to an xtd::array, starting at a particular xtd::array index.
|
| auto | get_enumerator () const -> xtd::collections::generic::enumerator< value_type > override |
| | Returns an enumerator that iterates through a collection.
|
| auto | get_or_add (const key_t &key, xtd::callable< value_t, key_t > auto &&add_value_factory) -> const value_t & |
| | Adds a key/value pair to the xtd::collections::concurrent::concurrent_dictionary <key_t, value_t> by using the specified function if the key does not already exist. Returns the new value, or the existing value if the key exists.
|
| auto | get_or_add (const key_t &key, const value_t &add_value) -> const value_t & |
| | Adds a key/value pair to the xtd::collections::concurrent::concurrent_dictionary <key_t, value_t> if the key does not already exist. Returns the new value, or the existing value if the key exists.
|
| template<typename arg_t> |
| auto | get_or_add (const key_t &key, xtd::callable< value_t, key_t, arg_t > auto &&add_value_factory, arg_t &&factory_argument) -> const value_t & |
| | Adds a key/value pair to the xtd::collections::concurrent::concurrent_dictionary <key_t, value_t> by using the specified function and an argument if the key does not already exist, or returns the existing value if the key exists.
|
| auto | to_array () const -> xtd::array< value_type > |
| | Copies the elements contained in the xtd::collections::concurrent::concurrent_dictionary <key_t, value_t> to a new array.
|
| auto | to_string () const noexcept -> xtd::string override |
| | Returns a xtd::string that represents the current object.
|
| auto | try_add (const key_t &key, const value_t &value) -> bool |
| | Attempts to add the specified key and value to the xtd::collections::concurrent::concurrent_dictionary<key_t,value_t>.
|
| auto | try_get_value (const key_t &key, value_t &value) const -> bool override |
| | Attempts to get the value associated with the specified key from the xtd::collections::concurrent::concurrent_dictionary <key_t,value_t>.
|
| auto | try_remove (const key_t &key) -> bool |
| | Attempts to remove and return the value that has the specified key from the xtd::collections::concurrent::concurrent_dictionary <key_t,value_t>.
|
| auto | try_remove (const key_t &key, value_t &value) -> bool |
| | Attempts to remove and return the value that has the specified key from the xtd::collections::concurrent::concurrent_dictionary <key_t,value_t>.
|
| auto | try_remove (const xtd::collections::generic::key_value_pair< key_t, value_t > &item) -> bool |
| | Removes a key and value from the dictionary. @pram item The xtd::collections::generic::key_value_pair<key_t,value_t> representing the key and value to remove.
|
| auto | try_update (const key_t &key, const value_t &new_value, const value_t &comparison_value) -> bool |
| | Updates the value associated with key to new_value if the existing value with key is equal to comparison_value.
|
|
| 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.
|
| using | value_type |
| | Represents the xtd::collections::generic::icollection value type.
|
| using | value_type |
| | Represents the xtd::collections::generic::ienumerable 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 | iterator |
| | Represents the iterator of enumerable value type.
|
| using | const_iterator |
| | Represents the const iterator of enumerable value type.
|
| using | enumerable_type |
| | Represents the ienumerable enumerable type.
|
| using | value_type |
| | Represents the ienumerable value type.
|
| using | ienumerable |
| | Represents the ienumerable value type.
|
| using | list |
| | Represents the list value type.
|
| | object ()=default |
| | Create a new instance of the ultimate base class object.
|
| virtual auto | equals (const object &obj) const noexcept -> bool |
| | Determines whether the specified object is equal to the current object.
|
| virtual auto | get_hash_code () const noexcept -> xtd::usize |
| | Serves as a hash function for a particular type.
|
| virtual auto | get_type () const noexcept -> type_object |
| | Gets the type of the current instance.
|
| template<typename object_t> |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| | Creates a shallow copy of the current object.
|
| virtual auto | copy_to (xtd::array< xtd::collections::generic::key_value_pair< key_t, value_t > > &array, xtd::usize array_index) const -> void=0 |
| | Copies the elements of the xtd::collections::generic::icollection <type_t> to an xtd::array, starting at a particular xtd::array index.
|
| auto | begin () const -> const_iterator |
| | Returns an iterator to the first element of the enumerable.
|
| auto | cbegin () const -> const_iterator |
| | Returns an iterator to the first element of the enumerable.
|
| auto | cend () const -> const_iterator |
| | Returns an iterator to the element following the last element of the enumerable.
|
| auto | end () const -> const_iterator |
| | Returns an iterator to the element following the last element of the enumerable.
|
| auto | aggregate (auto &&funcfunc) const -> value_t |
| | Applies an accumulator function over a sequence.
|
| auto | all (predicate_t &&predicatepredicate) const -> bool |
| | Determines whether all elements of a sequence satisfy a condition.
|
| auto | any () const noexcept -> bool |
| | Determines whether a sequence contains any elements.
|
| auto | append (element_t &&element) const noexcept -> xtd::collections::generic::enumerable_generator< value_t > |
| | Appends a value to the end of the sequence.
|
| auto | as_enumerable () const noexcept |
| | Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
|
| auto | average () const noexcept |
| | Computes the average of a sequence of value_t values.
|
| auto | cast () const noexcept -> xtd::collections::generic::enumerable_generator< result_t > |
| | Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
|
| auto | chunk (xtd::usize size) const -> xtd::collections::generic::enumerable_generator< xtd::array< value_t > > |
| | Splits the elements of a sequence into chunks of size at most size.
|
| auto | concat (second_t &&second) const noexcept -> xtd::collections::generic::enumerable_generator< value_t > |
| | Concatenates two sequences.
|
| auto | contains (value_t &&value) const noexcept -> bool |
| | Determines whether a sequence contains a specified element by using the default equality comparer.
|
| auto | count () const noexcept -> xtd::usize |
| | Returns the number of elements in current sequence.
|
| auto | count_by (key_selector_t &&key_selector) const noexcept |
| | Returns the count of elements in the current sequence grouped by key.
|
| auto | default_if_empty () const noexcept -> xtd::collections::generic::enumerable_generator< value_t > |
| | Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty.
|
| auto | distinct () const noexcept -> xtd::collections::generic::enumerable_generator< value_t > |
| | Returns distinct elements from a sequence by using the default equality comparer to compare values.
|
| auto | first () const -> value_t |
| | Returns the first element of a sequence.
|
| auto | first_or_default (predicate_t &&predicatepredicate, value_t &&default_value) const noexcept -> value_t |
| | Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found.
|
| auto | last () const -> value_t |
| | Returns the last element of a sequence.
|
| auto | max () const -> value_t |
| | Returns the maximum value in a sequence of xtd::numeric values.
|
| auto | min () const -> value_t |
| | Returns the minimum value in a sequence of xtd::numeric values.
|
| auto | order () const -> xtd::collections::generic::enumerable_generator< value_t > |
| | Sorts the elements of a sequence in ascending order.
|
| auto | order_by (const std::function< value_t(const value_t &)> &key_selector) const |
| | Sorts the elements of a sequence in ascending order according to a key.
|
| auto | order_by_descending (const std::function< key_t(const value_t &)> &key_selector) const |
| | Sorts the elements of a sequence in descending order according to a key.
|
| auto | reverse () const -> xtd::collections::generic::enumerable_generator< value_t > |
| | Inverts the order of the elements in a sequence.
|
| auto | select (auto &&selector) const |
| | Projects each element of a sequence into a new form.
|
| auto | sequence_equal (second_t &&second) const -> bool |
| | Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.
|
| auto | shuffle () const -> xtd::collections::generic::enumerable_generator< value_t > |
| | Shuffles the order of the elements of a sequence.
|
| auto | skip (xtd::usize count) const -> xtd::collections::generic::enumerable_generator< value_t > |
| | Bypasses a specified number of elements in a sequence and then returns the remaining elements.
|
| auto | skip_while (auto &&predicatepredicate) const -> xtd::collections::generic::enumerable_generator< value_t > |
| | Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
|
| auto | take (xtd::usize count) const -> xtd::collections::generic::enumerable_generator< value_t > |
| | Returns a specified number of contiguous elements from the start of a sequence.
|
| auto | take_while (auto &&predicatepredicate) const -> xtd::collections::generic::enumerable_generator< value_t > |
| | Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.
|
| auto | to_array () const -> xtd::array< value_t > |
| | Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>.
|
| auto | to_list () const -> xtd::collections::generic::list< value_t > |
| | Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>.
|
| auto | where (auto &&predicatepredicate) const |
| | Filters a sequence of values based on a predicate.
|
| auto | zip (second_t &&second) const -> xtd::collections::generic::enumerable_generator< std::tuple< value_t, xtd::iterable_value_type< second_t > > > |
| | Produces a sequence of tuples with elements from the two specified sequences.
|
| virtual auto | empty () const noexcept -> bool |
| | Checks whether the container is empty.
|
| virtual auto | size () const noexcept -> xtd::usize |
| | Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.
|
| virtual auto | operator<< (const xtd::collections::generic::key_value_pair< key_t, value_t > &item) -> icollection< xtd::collections::generic::key_value_pair< key_t, value_t > > & |
| | The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>.
|
| virtual auto | operator>> (const xtd::collections::generic::key_value_pair< key_t, value_t > &item) -> icollection< xtd::collections::generic::key_value_pair< key_t, value_t > > & |
| | The shift right operator removes the first occurrence of a specific object from the xtd::collections::generic::icollection <type_t>.
|
| template<typename object_a_t, typename object_b_t> |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| | Determines whether the specified object instances are considered equal.
|
| template<typename object_a_t, typename object_b_t> |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| | Determines whether the specified object instances are the same instance.
|
| static auto | to_const_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| | Converts source iterator to target iterator.
|
| static auto | to_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| | Converts source iterator to target iterator.
|