15#include <unordered_map>
66 template<
class key_t,
class value_t,
class hasher_t = helpers::hasher<key_t>,
class equator_t = helpers::equator<key_t>,
class allocator_t = helpers::allocator<std::pair<const key_t, value_t>>>
91 if (comparer)
return comparer->get_hash_code(key);
92 return hasher_t {}(key);
125 if (&
a == &
b)
return true;
126 if (comparer)
return comparer->equals(
a,
b);
127 return equator_t {}(
a,
b);
159 using base_type = std::unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>;
165 using pointer =
typename std::allocator_traits<allocator_t>::pointer;
167 using const_pointer =
typename std::allocator_traits<allocator_t>::const_pointer;
241 for (
const auto& item : collection)
250 template<
class equality_comparer_t>
276 dictionary(size_type bucket_count, const allocator_type& alloc) noexcept : data_(xtd::new_ptr<data>(bucket_count)) {}
301 template<
class equality_comparer_t>
312 template<
class equality_comparer_t>
314 for (
const auto& item : collection)
328 template<
class equality_comparer_t>
337 explicit dictionary(const allocator_t& alloc) noexcept {}
350 template <
class input_iterator_t>
353 const auto& [key, value] = *
iterator;
365 template <
class input_iterator_t>
368 const auto& [key, value] = *
iterator;
381 template <
class input_iterator_t>
384 const auto& [key, value] = *
iterator;
404 dictionary(const dictionary& other, const allocator_type& alloc) noexcept : data_(xtd::new_ptr<data>(other.data_->comparer, other.data_->items, other.data_->version)) {}
416 const auto& [key, value] = *
iterator;
430 const auto& [key, value] = *
iterator;
463 for (
const auto& [key, value] : init)
477 for (
const auto& [key, value] : init)
492 for (
const auto& [key, value] : init)
507 template <
class init_key_t,
class init_value_t>
509 for (
const auto& [key, value] : init)
522 template <
class init_key_t,
class init_value_t>
524 for (
const auto& [key, value] : init)
538 template <
class init_key_t,
class init_value_t>
540 for (
const auto& [key, value] : init)
577 if (data_->comparer)
return *data_->comparer;
590 bool empty() const noexcept {
return data_->items.empty();}
634 for (
const auto& [key, value] : data_->items)
695 for (
const auto& [key, value] : data_->items)
710 void add(
const key_t& key,
const value_t value)
override {
710 void add(
const key_t& key,
const value_t value)
override {
…}
718 add(item.key(), item.value());
727 const value_t&
at(
const key_t& key)
const {
728 auto iterator = data_->items.find(key);
727 const value_t&
at(
const key_t& key)
const {
…}
738 value_t&
at(
const key_t& key) {
739 auto iterator = data_->items.find(key);
738 value_t&
at(
const key_t& key) {
…}
749 return data_->items.begin(
n);
757 return data_->items.begin(
n);
775 return data_->items.begin(
n);
783 return data_->items.end(
n);
789 data_->items.clear();
796 return data_->items.find(key) != data_->items.end();
801 template <
class contains_key_t>
803 return data_->items.find(
x) != data_->items.end();
812 return iterator->value() == item.value();
823 bool contains_value(
const value_t& value)
const noexcept {
824 for (
const auto& [item_key, item_value] : *
this)
825 if (item_value == value)
return true;
836 for (
const auto& item : *
this)
837 array[array_index + index++] = item;
848 template <
class ...args_t>
850 const auto& [
iterator, succeeded] = data_->items.emplace(std::forward<args_t>(args)...);
851 if (succeeded) ++data_->version;
852 return {to_type_iterator(
iterator), succeeded};
863 template <
class ...args_t>
866 return to_type_iterator(data_->items.emplace_hint(to_base_type_iterator(hint), std::forward<args_t>(args)...));
874 return data_->items.end(
n);
882 return data_->items.end(
n);
898 const auto& [
first,
last] = data_->items.equal_range(key);
899 return {to_type_iterator(
first), to_type_iterator(
last)};
906 template <
class equal_range_key_t>
908 const auto& [
first,
last] = data_->items.equal_range(key);
909 return {to_type_iterator(
first), to_type_iterator(
last)};
916 template <
class equal_range_key_t>
918 const auto& [
first,
last] = data_->items.equal_range(
x);
919 return {to_type_iterator(
first), to_type_iterator(
last)};
927 const auto& [
first,
last] = data_->items.equal_range(
x);
928 return {to_type_iterator(
first), to_type_iterator(
last)};
940 return to_const_type_iterator(data_->items.erase(to_const_base_type_iterator(pos)));
952 return to_const_type_iterator(data_->items.erase(to_const_base_type_iterator(
first), to_const_base_type_iterator(
last)));
962 auto removed_count = data_->items.erase(key);
963 if (removed_count) ++data_->version;
964 return removed_count;
975 return data_->items.extract(to_const_base_type_iterator(position));
985 return data_->items.extract(
k);
993 return to_const_type_iterator(data_->items.find(key));
1001 return to_const_type_iterator(data_->items.find(key));
1008 template <
class find_key_t>
1010 return to_const_type_iterator(data_->items.find(
x));
1016 template <
class find_key_t>
1018 return to_type_iterator(data_->items.find(
x));
1028 struct internal_enumerator :
public ienumerator<value_type> {
1034 if (iterator_ != items_.items().cend()) {
1035 static thread_local auto value =
value_type {};
1039 static auto default_value_type =
value_type {};
1040 return default_value_type;
1043 bool move_next()
override {
1045 if (!reset_)
return ++iterator_ != items_.items().cend();
1047 iterator_ = items_.items().cbegin();
1048 return iterator_ != items_.items().cend();
1051 void reset()
override {
1053 version_ = items_.data_->version;
1054 iterator_ = items_.items().cend();
1060 typename dictionary::base_type::const_iterator iterator_ = items_.
items().cend();
1070 return data_->items.hash_function();
1080 const auto& [
iterator, succeeded] = data_->items.insert(value);
1081 if (succeeded) ++data_->version;
1082 return {to_type_iterator(
iterator), succeeded};
1091 const auto& [
iterator, succeeded] = data_->items.insert(value);
1092 if (succeeded) ++data_->version;
1093 return {to_type_iterator(
iterator), succeeded};
1102 template <
class type_t>
1104 const auto& [
iterator, succeeded] = data_->items.insert(value);
1105 if (succeeded) ++data_->version;
1106 return {to_type_iterator(
iterator), succeeded};
1117 return to_const_type_iterator(data_->items.insert(to_const_base_type_iterator(hint), value));
1128 return to_const_type_iterator(data_->items.insert(to_const_base_type_iterator(hint), value));
1138 template <
class type_t>
1141 return to_const_type_iterator(data_->items.insert(to_const_base_type_iterator(hint), value));
1150 template <
class input_iterator_t>
1153 const auto& [key, value] = *
iterator;
1162 void insert(std::initializer_list<base_value_type> ilist) {
1163 for (
const auto& [key, value] : ilist)
1164 add(std::forward<value_type>({key, value}));
1162 void insert(std::initializer_list<base_value_type> ilist) {
…}
1171 template <
class init_key_t,
class init_value_t>
1173 for (
const auto& [key, value] : ilist)
1174 add(std::forward<value_type>({key, value}));
1187 return data_->items.inser(nh);
1199 return to_const_type_iterator(data_->items.inser(to_const_base_type_iterator(hint), nh));
1209 template <
class type_t>
1211 const auto& [
iterator, succeeded] = data_->items.insert_or_assign(
k, obj);
1212 if (succeeded) ++data_->version;
1213 return {to_type_iterator(
iterator), succeeded};
1222 template <
class type_t>
1224 const auto& [
iterator, succeeded] = data_->items.insert_or_assign(std::move(
k), obj);
1225 if (succeeded) ++data_->version;
1226 return {to_type_iterator(
iterator), succeeded};
1236 template <
class type_t>
1239 return to_const_type_iterator(data_->items.insert_or_assign(to_const_base_type_iterator(hint),
k, obj));
1249 template <
class type_t>
1252 return to_const_type_iterator(data_->items.insert_or_assign(to_const_base_type_iterator(hint), std::move(
k), obj));
1259 return data_->items.key_eq();
1266 template <
class source_hasher_t,
class source_equator_t>
1268 data_->items.merge(source.
items);
1276 template <
class source_hasher_t,
class source_equator_t>
1278 data_->items.merge(std::move(source.items));
1286 template <
class source_hasher_t,
class source_equator_t>
1287 void merge(std::unordered_map<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>& source) {
1288 data_->items.merge(source);
1287 void merge(std::unordered_map<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>& source) {
…}
1296 template <
class source_hasher_t,
class source_equator_t>
1297 void merge(std::unordered_map<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>&& source) {
1298 data_->items.merge(std::move(source));
1297 void merge(std::unordered_map<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>&& source) {
…}
1306 template <
class source_hasher_t,
class source_equator_t>
1307 void merge(std::unordered_multimap<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>& source) {
1308 data_->items.merge(source);
1307 void merge(std::unordered_multimap<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>& source) {
…}
1316 template <
class source_hasher_t,
class source_equator_t>
1317 void merge(std::unordered_multimap<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>&& source) {
1318 data_->items.merge(std::move(source));
1317 void merge(std::unordered_multimap<key_t, value_t, source_hasher_t,source_equator_t, allocator_t>&& source) {
…}
1327 data_->items.rehash(
count);
1334 bool remove(
const key_t& key)
noexcept override {
1335 return erase(key) == 1;
1334 bool remove(
const key_t& key)
noexcept override {
…}
1342 if (!contains_value(item.value()))
return false;
1343 return erase(item.key()) == 1;
1349 bool remove(
const key_t& key, value_t& value)
noexcept {
1349 bool remove(
const key_t& key, value_t& value)
noexcept {
…}
1360 data_->items.reserve(
count);
1368 data_->items.swap(
other.data_->items);
1369 std::swap(data_->version,
other.data_->version);
1374 xtd::string to_string() const noexcept
override {
return xtd::string::format(
"{{{}}}", xtd::string::join(
", ", *
this));}
1400 bool try_add(
const key_t& key,
const value_t value)
noexcept {
1401 const auto& [
iterator, succeeded] = data_->items.insert(std::forward<base_value_type>({key, value}));
1402 if (succeeded) ++data_->version;
1400 bool try_add(
const key_t& key,
const value_t value)
noexcept {
…}
1413 template <
class ...args_t>
1415 const auto& [
iterator, succeeded] = to_type_iterator(data_->items.try_emplace(
k, std::forward<args_t>(args)...));
1416 if (succeeded) ++data_->version;
1417 return {to_type_iterator(
iterator), succeeded};
1426 template <
class ...args_t>
1428 const auto& [
iterator, succeeded] = to_type_iterator(data_->items.try_emplace(std::move(
k), std::forward<args_t>(args)...));
1429 if (succeeded) ++data_->version;
1430 return {to_type_iterator(
iterator), succeeded};
1440 template <
class ...args_t>
1443 return to_const_type_iterator(data_->items.try_emplace(to_const_base_type_iterator(hint),
k, std::forward<args_t>(args)...));
1453 template <
class ...args_t>
1456 return to_const_type_iterator(data_->items.try_emplace(to_const_base_type_iterator(hint), std::move(
k), std::forward<args_t>(args)...));
1481 data_->comparer = std::move(
other.data_->comparer);
1482 data_->items = std::move(
other.data_->items);
1483 data_->version = std::move(
other.data_->version);
1490 data_->items = std::move(
other);
1502 data_->items.clear();
1503 for (
const auto& [key, value] :
other)
1510 data_->
items.clear();
1511 for (
const auto& [key, value] : ilist)
1517 template <
class init_key_t,
class init_value_t>
1519 data_->
items.clear();
1520 for (
const auto& [key, value] : ilist)
1540 return data_->items[key];}
1544 operator const base_type&()
const noexcept {
return data_->items;}
1551 typename base_type::const_iterator to_const_base_type_iterator(
const_iterator value)
const noexcept {
1555 const_iterator to_const_type_iterator(
typename base_type::const_iterator value)
const noexcept {
1559 typename base_type::const_iterator to_base_type_iterator(
const_iterator value)
const noexcept {
1560 return idictionary<key_t, value_t>::to_iterator(value, *
this, data_->items);
1563 typename base_type::iterator to_base_type_iterator(
iterator value)
noexcept {
1564 return idictionary<key_t, value_t>::to_iterator(value, *
this, data_->items);
1567 const_iterator to_type_iterator(
typename base_type::const_iterator value)
const noexcept {
1568 return idictionary<key_t, value_t>::to_iterator(value, data_->items, *
this);
1571 iterator to_type_iterator(
typename base_type::iterator value)
noexcept {
1572 return idictionary<key_t, value_t>::to_iterator(value, data_->items, *
this);
1577 data(
ptr<iequality_comparer<key_t>> comparer) : comparer {comparer}, items {
size_type {}, hasher {comparer.get()}, equator {comparer.get()},
allocator_type {}} {}
1579 data(
ptr<iequality_comparer<key_t>> comparer,
const base_type& items,
size_type version) noexcept : comparer {comparer}, items {
size_type {}, hasher {comparer.get()}, equator {comparer.get()},
allocator_type {}}, version {version} {
1580 for (
const auto& item : items)
1581 this->items.insert(item);
1584 for (
auto&& item : items)
1585 this->items.insert(item);
1591 xtd::object sync_root;
1599 template<
class key_t,
class value_t>
1602 template<
class key_t,
class value_t>
1605 template<
class key_t,
class value_t,
class hasher_t = helpers::hasher<key_t>,
class equator_t = helpers::equator<key_t>,
class allocator_t = helpers::allocator<std::pair<const key_t, value_t>>>
1608 template<
class key_t,
class value_t,
class allocator_t>
1611 template<
class key_t,
class value_t,
class allocator_t>
1614 template<
class key_t,
class value_t,
class hasher_t,
class allocator_t>
1617 template<
class key_t,
class value_t,
class hasher_t = helpers::hasher<key_t>,
class equator_t = helpers::equator<key_t>,
class allocator_t = helpers::allocator<std::pair<const key_t, value_t>>>
1620 template<
class key_t,
class value_t,
class allocator_t>
1623 template<
class key_t,
class value_t,
class allocator_t>
1626 template<
class key_t,
class value_t,
class hasher_t,
class allocator_t>
1629 template<
class input_iterator_t,
class hasher_t = helpers::hasher<helpers::iterator_key_t<input_iterator_t>>,
class equator_t = helpers::equator<helpers::iterator_key_t<input_iterator_t>>,
class allocator_t = helpers::allocator<helpers::iterator_to_allocator_t<input_iterator_t>>>
1632 template<
class input_iterator_t,
class allocator_t>
1635 template<
class input_iterator_t,
class allocator_t>
1638 template<
class input_iterator_t,
class hasher_t,
class allocator_t>
Contains xtd::collections::generic::helpers::allocator alias.
Contains xtd::argument_out_of_range_exception exception.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::array::begin(),...
Definition basic_array.hpp:229
Provides a base class for implementations of the xtd::collections::generic::icomparer <type_t> generi...
Definition comparer.hpp:33
Represents a collection of keys and values.
Definition dictionary.hpp:67
void trim_excess(size_type capacity)
Definition dictionary.hpp:1380
void merge(std::unordered_map< key_t, value_t, source_hasher_t, source_equator_t, allocator_t > &&source)
Definition dictionary.hpp:1297
size_type max_size() const noexcept
Definition dictionary.hpp:657
const xtd::object & sync_root() const noexcept override
Definition dictionary.hpp:687
dictionary(dictionary &&other) noexcept=default
typename base_type::node_type node_type
Represents the dictionary node type.
Definition dictionary.hpp:177
bool remove(const key_t &key, value_t &value) noexcept
Definition dictionary.hpp:1349
local_iterator end(size_type n)
Definition dictionary.hpp:873
dictionary(std::initializer_list< base_value_type > init, size_type bucket_count, const helpers::hasher< key_t > &hash, const allocator_type &alloc)
Definition dictionary.hpp:491
const value_t & operator[](const key_t &key) const override
Gets the element with the specified key.
Definition dictionary.hpp:1531
const_iterator try_emplace(const_iterator hint, const key_t &k, args_t &&... args)
Definition dictionary.hpp:1441
dictionary(std::initializer_list< key_value_pair< init_key_t, init_value_t > > init, size_type bucket_count, const helpers::hasher< key_t > &hash, const allocator_type &alloc)
Definition dictionary.hpp:539
hasher hash_function() const
Definition dictionary.hpp:1069
dictionary(std::unordered_map< key_t, value_t > &&other) noexcept
Definition dictionary.hpp:446
const_iterator find(const key_t &key) const
Finds element with specific key.
Definition dictionary.hpp:992
key_value_pair< iterator, bool > insert(type_t &&value)
Definition dictionary.hpp:1103
equator key_equal
Represents the dictionary key_equal type.
Definition dictionary.hpp:153
const_iterator try_emplace(const_iterator hint, key_t &&k, args_t &&... args)
Definition dictionary.hpp:1454
value_type & reference
Represents the dictionary reference type.
Definition dictionary.hpp:161
typename xtd::collections::generic::idictionary< key_type, mapped_type >::value_type value_type
Represents the dictionary value type.
Definition dictionary.hpp:147
insert_return_type insert(node_type &&nh)
Definition dictionary.hpp:1185
void add(const value_type &item) override
Definition dictionary.hpp:717
node_type extract(const key_t k)
Definition dictionary.hpp:983
size_type capacity() const noexcept
Definition dictionary.hpp:563
key_value_pair< iterator, bool > insert(const value_type &value)
Definition dictionary.hpp:1079
typename base_type::const_local_iterator const_local_iterator
Represents the const local iterator of dictionary value type.
Definition dictionary.hpp:175
const_iterator insert(const_iterator hint, node_type &&nh)
Definition dictionary.hpp:1197
key_value_pair< iterator, bool > try_emplace(key_t &&k, args_t &&... args)
Definition dictionary.hpp:1427
dictionary(const std::unordered_map< key_t, value_t > &other)
Definition dictionary.hpp:414
const iequality_comparer< key_t > & comparer() const noexcept
Gets the td::collections::generic::iequality_comparer <type_t> that is used to determine equality of ...
Definition dictionary.hpp:576
dictionary(const ienumerable< value_type > &collection, const equality_comparer_t &comparer)
Definition dictionary.hpp:313
void insert(std::initializer_list< base_value_type > ilist)
Definition dictionary.hpp:1162
const_local_iterator cbegin(size_type n) const
Definition dictionary.hpp:774
value_t & at(const key_t &key)
Definition dictionary.hpp:738
dictionary(size_t capacity, const equality_comparer_t &comparer)
Definition dictionary.hpp:329
size_type bucket(const key_t &key) const
Definition dictionary.hpp:763
void copy_to(xtd::array< value_type > &array, xtd::size array_index) const override
Definition dictionary.hpp:833
void reserve(size_type count)
Definition dictionary.hpp:1359
const_iterator insert(const_iterator hint, value_type &&value)
Definition dictionary.hpp:1126
void swap(dictionary &other) noexcept
Definition dictionary.hpp:1367
dictionary(std::initializer_list< base_value_type > init, size_type bucket_count=0, const helpers::hasher< key_t > &hash=helpers::hasher< key_t > {}, const helpers::equator< key_t > &equal=helpers::equator< key_t > {}, const allocator_type &alloc=allocator_type {})
Definition dictionary.hpp:462
dictionary(input_iterator_t first, input_iterator_t last, size_type bucket_count, const helpers::hasher< key_t > &hash, const allocator_type &alloc)
Definition dictionary.hpp:382
xtd::size ensure_capacity(xtd::size capacity) noexcept
Ensures that the dictionary can hold up to a specified number of entries without any further expansio...
Definition dictionary.hpp:888
const_iterator insert(const_iterator hint, type_t &&value)
Definition dictionary.hpp:1139
const_iterator insert_or_assign(const_iterator hint, const key_t &k, type_t &&obj)
Definition dictionary.hpp:1237
std::unordered_map< key_type, mapped_type, hasher, key_equal, allocator_type > base_type
Represents the dictionary base type.
Definition dictionary.hpp:159
typename xtd::collections::generic::idictionary< key_type, mapped_type >::key_collection key_collection
Represents the idictionary key collection type.
Definition dictionary.hpp:181
key_value_pair< iterator, bool > insert(value_type &&value)
Definition dictionary.hpp:1090
const_iterator find(const find_key_t &x) const
Definition dictionary.hpp:1009
void clear() noexcept override
Definition dictionary.hpp:788
dictionary() noexcept=default
Initializes a new instance of the xtd::collections::generic::dictionary <key_t, value_t> class that i...
dictionary(const std::unordered_map< key_t, value_t > &other, const allocator_type &alloc)
Definition dictionary.hpp:428
bool empty() const noexcept
Definition dictionary.hpp:590
bool try_add(const key_t &key, const value_t value) noexcept
Attempts to add the specified key and value to the dictionary.
Definition dictionary.hpp:1400
const value_t & at(const key_t &key) const
Definition dictionary.hpp:727
typename xtd::collections::generic::idictionary< key_type, mapped_type >::value_collection value_collection
Represents the idictionary value collection type.
Definition dictionary.hpp:183
bool remove(const value_type &item) noexcept override
Definition dictionary.hpp:1341
void merge(dictionary< key_t, value_t, source_hasher_t, source_equator_t, allocator_t > &&source)
Definition dictionary.hpp:1277
const_iterator insert(const_iterator hint, const value_type &value)
Definition dictionary.hpp:1115
const_iterator begin() const noexcept override
Definition dictionary.hpp:550
key_value_pair< const_iterator, const_iterator > equal_range(const key_t &x) const
Definition dictionary.hpp:926
key_value_pair< iterator, bool > emplace(args_t &&...args)
Definition dictionary.hpp:849
dictionary(std::unordered_map< key_t, value_t > &&other, const allocator_type &alloc) noexcept
Definition dictionary.hpp:451
key_equal key_eq() const
Definition dictionary.hpp:1258
iterator emplace_hint(iterator hint, args_t &&...args)
Definition dictionary.hpp:864
std::pair< const key_t, value_t > base_value_type
Represents the dictionary base value type.
Definition dictionary.hpp:157
iterator find(const find_key_t &x)
Definition dictionary.hpp:1017
key_value_pair< iterator, iterator > equal_range(const key_t &key)
Definition dictionary.hpp:897
bool remove(const key_t &key) noexcept override
Definition dictionary.hpp:1334
void rehash(size_type count)
Definition dictionary.hpp:1326
const_local_iterator begin(size_type n) const
Definition dictionary.hpp:756
dictionary(input_iterator_t first, input_iterator_t last, size_type bucket_count=0, const helpers::hasher< key_t > &hash=helpers::hasher< key_t > {}, const helpers::equator< key_t > &equal=helpers::equator< key_t > {}, const allocator_type &alloc=allocator_type {})
Definition dictionary.hpp:351
node_type extract(const_iterator position) noexcept
Definition dictionary.hpp:973
typename xtd::collections::generic::idictionary< key_type, mapped_type >::const_iterator const_iterator
Represents the const iterator of dictionary value type.
Definition dictionary.hpp:171
bool contains(const key_t &key) const noexcept
Definition dictionary.hpp:795
void trim_excess()
Definition dictionary.hpp:1391
typename base_type::insert_return_type insert_return_type
Represents the dictionary insert return type.
Definition dictionary.hpp:179
dictionary & operator=(dictionary &&other) noexcept
Move assignment operator. Replaces the contents with a copy of the contents of other.
Definition dictionary.hpp:1480
const_iterator end() const noexcept override
Definition dictionary.hpp:594
void insert(input_iterator_t first, input_iterator_t last)
Definition dictionary.hpp:1151
typename std::allocator_traits< allocator_t >::pointer pointer
Represents the dictionary pointer type.
Definition dictionary.hpp:165
dictionary(input_iterator_t first, input_iterator_t last, size_type bucket_count, const allocator_type &alloc)
Definition dictionary.hpp:366
key_value_pair< const_iterator, const_iterator > equal_range(const equal_range_key_t &key) const
Definition dictionary.hpp:907
dictionary(std::initializer_list< key_value_pair< init_key_t, init_value_t > > init, size_type bucket_count, const allocator_type &alloc)
Definition dictionary.hpp:523
size_type bucket_size(size_type n) const noexcept
Definition dictionary.hpp:768
local_iterator begin(size_type n)
Definition dictionary.hpp:748
iterator end() noexcept override
Definition dictionary.hpp:598
void add(const key_t &key, const value_t value) override
Definition dictionary.hpp:710
bool contains(const value_type &item) const noexcept override
Definition dictionary.hpp:809
dictionary(size_type bucket_count, const helpers::hasher< key_t > &hash, const allocator_type &alloc) noexcept
Definition dictionary.hpp:289
key_value_pair< iterator, iterator > equal_range(const equal_range_key_t &x)
Definition dictionary.hpp:917
bool is_synchronized() const noexcept override
Definition dictionary.hpp:619
const_iterator erase(const_iterator pos)
Definition dictionary.hpp:938
size_type size() const noexcept
Definition dictionary.hpp:664
const_local_iterator end(size_type n) const
Definition dictionary.hpp:881
value_collection values() const noexcept override
Definition dictionary.hpp:693
void merge(dictionary< key_t, value_t, source_hasher_t, source_equator_t, allocator_t > &source)
Definition dictionary.hpp:1267
const_iterator insert_or_assign(const_iterator hint, key_t &&k, type_t &&obj)
Definition dictionary.hpp:1250
size_type erase(const key_t &key)
Definition dictionary.hpp:961
dictionary(const dictionary &other) noexcept
Definition dictionary.hpp:394
void insert(std::initializer_list< key_value_pair< init_key_t, init_value_t > > ilist)
Definition dictionary.hpp:1172
dictionary(dictionary &&other, const allocator_type &alloc) noexcept
Definition dictionary.hpp:442
const_local_iterator cend(size_type n) const
Definition dictionary.hpp:782
void merge(std::unordered_map< key_t, value_t, source_hasher_t, source_equator_t, allocator_t > &source)
Definition dictionary.hpp:1287
dictionary(const idictionary< key_t, value_t > &dictionary, const equality_comparer_t &comparer)
Definition dictionary.hpp:302
typename xtd::collections::generic::idictionary< key_t, value_t >::mapped_type mapped_type
Represents the dictionary mapped type.
Definition dictionary.hpp:145
enumerator< value_type > get_enumerator() const noexcept override
Definition dictionary.hpp:1027
bool contains(const contains_key_t &x) const
Definition dictionary.hpp:802
key_collection keys() const noexcept override
Definition dictionary.hpp:632
const_iterator cbegin() const noexcept override
Definition dictionary.hpp:567
typename xtd::collections::generic::idictionary< key_t, value_t >::key_type key_type
Represents the dictionary key type.
Definition dictionary.hpp:143
virtual const base_type & items() const noexcept
Definition dictionary.hpp:623
void merge(std::unordered_multimap< key_t, value_t, source_hasher_t, source_equator_t, allocator_t > &source)
Definition dictionary.hpp:1307
bool try_get_value(const key_t &key, value_t &value) const override
Definition dictionary.hpp:1463
key_value_pair< iterator, bool > insert_or_assign(key_t &&k, type_t &&obj)
Definition dictionary.hpp:1223
dictionary(const equality_comparer_t &comparer)
Definition dictionary.hpp:251
dictionary(std::initializer_list< base_value_type > init, size_type bucket_count, const allocator_type &alloc)
Definition dictionary.hpp:476
bool contains_key(const key_t &key) const noexcept override
Definition dictionary.hpp:819
float load_factor() const
Definition dictionary.hpp:641
allocator_t allocator_type
Represents the dictionary allocator type.
Definition dictionary.hpp:155
void merge(std::unordered_multimap< key_t, value_t, source_hasher_t, source_equator_t, allocator_t > &&source)
Definition dictionary.hpp:1317
iterator begin() noexcept override
Definition dictionary.hpp:553
size_type bucket_count() const noexcept
Definition dictionary.hpp:558
const_iterator cend() const noexcept override
Definition dictionary.hpp:571
xtd::ptrdiff difference_type
Represents the dictionary difference type.
Definition dictionary.hpp:151
void max_load_factor(float value) const
Definition dictionary.hpp:652
const value_type & const_reference
Represents the dictionary const reference type.
Definition dictionary.hpp:163
key_value_pair< iterator, bool > insert_or_assign(const key_t &k, type_t &&obj)
Definition dictionary.hpp:1210
size_type max_bucket_count() const noexcept
Definition dictionary.hpp:645
typename base_type::local_iterator local_iterator
Represents the local iterator of dictionary value type.
Definition dictionary.hpp:173
const_iterator find(const key_t &key)
Definition dictionary.hpp:1000
allocator_type get_allocator() const noexcept
Definition dictionary.hpp:1023
dictionary(size_type bucket_count, const helpers::hasher< key_t > &hash=helpers::hasher< key_t > {}, const helpers::equator< key_t > &equal=helpers::equator< key_t > {}, const allocator_type &alloc=allocator_type {}) noexcept
Definition dictionary.hpp:264
const_iterator erase(const_iterator first, const_iterator last)
Definition dictionary.hpp:950
dictionary(const ienumerable< value_type > &collection)
Definition dictionary.hpp:240
xtd::string to_string() const noexcept override
Definition dictionary.hpp:1374
virtual base_type & items() noexcept
Definition dictionary.hpp:626
typename xtd::collections::generic::idictionary< key_type, mapped_type >::iterator iterator
Represents the iterator of dictionary value type.
Definition dictionary.hpp:169
bool is_read_only() const noexcept override
Definition dictionary.hpp:603
key_value_pair< iterator, bool > try_emplace(const key_t &k, args_t &&... args)
Definition dictionary.hpp:1414
float max_load_factor() const
Definition dictionary.hpp:649
xtd::size size_type
Represents the dictionary size type.
Definition dictionary.hpp:149
typename std::allocator_traits< allocator_t >::const_pointer const_pointer
Represents the dictionary const pointer type.
Definition dictionary.hpp:167
dictionary(std::initializer_list< key_value_pair< init_key_t, init_value_t > > init, size_type bucket_count=0, const helpers::hasher< key_t > &hash=helpers::hasher< key_t > {}, const helpers::equator< key_t > &equal=helpers::equator< key_t > {}, const allocator_type &alloc=allocator_type {})
Definition dictionary.hpp:508
size_type count() const noexcept override
Definition dictionary.hpp:586
static const equality_comparer & default_equality_comparer()
Gets the default equality comparer for the type specified by the generic argument.
Definition equality_comparer.hpp:42
virtual const_iterator begin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:155
virtual const_iterator cbegin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:162
virtual const_iterator cend() const
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:166
Represents a generic collection of key/value pairs.
Definition idictionary.hpp:44
xtd::collections::generic::list< mapped_type > value_collection
Definition idictionary.hpp:62
xtd::collections::generic::list< key_type > key_collection
Definition idictionary.hpp:60
typename xtd::collections::generic::icollection< value_type >::const_iterator const_iterator
Definition idictionary.hpp:58
xtd::any_object key_type
Definition idictionary.hpp:50
typename xtd::collections::generic::icollection< value_type >::iterator iterator
Definition idictionary.hpp:56
xtd::any_object mapped_type
Definition idictionary.hpp:52
typename xtd::collections::generic::icollection< xtd::collections::generic::key_value_pair< xtd::any_object, xtd::any_object > >::value_type value_type
Definition idictionary.hpp:54
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:36
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
Defines methods to support the comparison of objects for equality.
Definition iequality_comparer.hpp:34
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
Throws an exption with specified exception case.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.hpp:114
Contains xtd::collections::generic::helpers::equator struct.
Contains xtd::collections::generic::idictionary <key_t, value_t> interface.
Contains xtd::collections::generic::key_not_found_exception exception.
generic::idictionary< xtd::any_object, xtd::any_object > idictionary
interface IComparer exposes a method that compares two objects.
Definition idictionary.hpp:27
std::remove_const_t< std::tuple_element_t< 0, iterator_value_t< input_iterator_t > > > iterator_key_t
Represents the key iterator type.
Definition iterator.hpp:44
std::allocator< type_t > allocator
Represent an allocator alias.
Definition allocator.hpp:38
std::tuple_element_t< 1, iterator_value_t< input_iterator_t > > iterator_mapped_t
Represents the mapped iterator type.
Definition iterator.hpp:57
@ argument
The argument is not valid.
Definition exception_case.hpp:31
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
@ invalid_operation
The operation is not valid.
Definition exception_case.hpp:63
@ key_not_found
The key is not found.
Definition exception_case.hpp:69
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
std::ptrdiff_t ptrdiff
Represent the signed integer type of the result of subtracting two pointers.
Definition ptrdiff.hpp:23
ptr< type_t > new_ptr(args_t &&... args)
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
@ other
The operating system is other.
Definition platform_id.hpp:58
@ a
The A key.
Definition console_key.hpp:88
@ add
The Add key.
Definition console_key.hpp:170
@ n
The N key.
Definition console_key.hpp:114
@ k
The K key.
Definition console_key.hpp:108
@ b
The B key.
Definition console_key.hpp:90
@ x
The X key.
Definition console_key.hpp:134
Contains xtd::collections::generic::helpers::hasher struct.
Contains iteraors aliases.
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
read_only_span< type_t, count > first() const
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:282
read_only_span< type_t, count > last() const
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:307
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::new_ptr method.
Represents the dictionary equator type.
Definition dictionary.hpp:104
bool operator()(const key_t &a, const key_t &b) const
checks if the specified a and b keys are equal.
Definition dictionary.hpp:124
key_t first_argument_type
Represents the first argument type.
Definition dictionary.hpp:109
bool result_type
Represents the result type.
Definition dictionary.hpp:113
key_t second_argument_type
Represents the second argument type.
Definition dictionary.hpp:111
Represents the dictionary hasher type.
Definition dictionary.hpp:73
key_t argument_type
Represents the argument type.
Definition dictionary.hpp:78
xtd::size result_type
Represents the result type.
Definition dictionary.hpp:80
size_t operator()(const key_t &key) const
Serves as a hash function for a specified key with a particular type (type_t).
Definition dictionary.hpp:90
Supports a simple iteration over a generic collection.
Definition enumerator.hpp:38
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:38
Implements a function object for hashing data.
Definition hasher.hpp:39
Defines a key/value pair that can be set or retrieved.
Definition key_value_pair.hpp:37