4#include <unordered_map>
16 template <
class MultiContainerIterator,
class ContainerIterator,
class KeyType,
class ValueType>
24 MultiContainerIterator DataMultiMapIt;
27 ContainerIterator DataMapIt;
40 IsMultiMap = other.IsMultiMap;
41 DataMultiMapIt = other.DataMultiMapIt;
42 DataMapIt = other.DataMapIt;
52 IsMultiMap = other.IsMultiMap;
53 DataMultiMapIt = other.DataMultiMapIt;
54 DataMapIt = other.DataMapIt;
65 const ContainerIterator& dataMapIt,
const bool& isMultiMap)
noexcept
67 IsMultiMap = isMultiMap;
68 DataMultiMapIt = dataMultiMapIt;
69 DataMapIt = dataMapIt;
83 IsMultiMap = other.IsMultiMap;
84 DataMultiMapIt = other.DataMultiMapIt;
85 DataMapIt = other.DataMapIt;
102 IsMultiMap = other.IsMultiMap;
103 DataMultiMapIt = other.DataMultiMapIt;
104 DataMapIt = other.DataMapIt;
120 return DataMultiMapIt != other.DataMultiMapIt;
122 return DataMapIt != other.DataMapIt;
135 return DataMultiMapIt == other.DataMultiMapIt;
137 return DataMapIt == other.DataMapIt;
173 std::pair<KeyType, ValueType>
operator*() const noexcept
176 return *DataMultiMapIt;
198 return DataMultiMapIt;
208 template <
class KeyType,
class ValueType>
210 typename std::unordered_map<KeyType, ValueType>::iterator, KeyType, ValueType>;
215 template <
class KeyType,
class ValueType>
217 typename std::map<KeyType, ValueType>::iterator, KeyType, ValueType>;
222 template <
class KeyType,
class ValueType>
224 typename std::map<KeyType, ValueType>::reverse_iterator, KeyType, ValueType>;
239 template <
class MultiContainer,
class Container,
class Iterator,
class KeyType,
class ValueType>
309 template <
class EmplaceKeyType,
class EmplaceValueType>
310 std::pair<Iterator, bool>
Emplace(EmplaceKeyType&& key, EmplaceValueType&& value)
noexcept
314 auto dataMultiMapIt =
DataMultiMap.emplace(std::forward<EmplaceKeyType>(key), std::forward<EmplaceValueType>(value));
315 return std::pair<Iterator, bool>(Iterator(dataMultiMapIt,
DataMap.
end(),
true),
true);
319 auto dataMapIt =
DataMap.emplace(std::forward<EmplaceKeyType>(key), std::forward<EmplaceValueType>(value));
320 return std::pair<Iterator, bool>(Iterator(
DataMultiMap.
end(), dataMapIt.first,
false), dataMapIt.second);
331 std::pair<Iterator, Iterator>
EqualRange(
const KeyType& data)
noexcept
336 return std::pair<Iterator, Iterator>(Iterator(rangePair.first,
DataMap.
end(),
true), Iterator(rangePair.second,
DataMap.
end(),
true));
340 auto rangePair =
DataMap.equal_range(data);
341 return std::pair<Iterator, Iterator>(Iterator(
DataMultiMap.
end(), rangePair.first,
false), Iterator(
DataMultiMap.
end(), rangePair.second,
false));
352 Iterator
Find(
const KeyType& data)
noexcept
361 auto retIt =
DataMap.find(data);
373 std::size_t
Erase(
const KeyType& data)
noexcept
391 Iterator
Erase(
const Iterator& dataIt)
noexcept
395 auto retIt =
DataMultiMap.erase(dataIt.GetMultiContainerIterator());
400 auto retIt =
DataMap.erase(dataIt.GetContainerIterator());
431 template <
class KeyType,
class ValueType>
432 class Map :
public ParentMap<std::multimap<KeyType, ValueType>, std::map<KeyType, ValueType>,
433 MapIterator<KeyType, ValueType>, KeyType, ValueType>
441 explicit Map(
const bool& isMultiMap)
noexcept
504 template <
class KeyType,
class ValueType>
505 class UnorderedMap :
public ParentMap<std::unordered_multimap<KeyType, ValueType>, std::unordered_map<KeyType, ValueType>,
506 UnorderedMapIterator<KeyType, ValueType>, KeyType, ValueType>
Iterator class for all library maps.
Definition Map.h:18
ContainerIterator GetContainerIterator() const noexcept
Method for get container iterator.
Definition Map.h:186
AllMapIterator & operator=(AllMapIterator &&other) noexcept
Deleted move assignment operator.
Definition Map.h:98
AllMapIterator & operator=(const AllMapIterator &other) noexcept
Assignment operator.
Definition Map.h:79
AllMapIterator() noexcept=default
Default constructor.
AllMapIterator & operator++() noexcept
Pre increment operator.
Definition Map.h:145
std::pair< KeyType, ValueType > operator*() const noexcept
Operator*.
Definition Map.h:173
~AllMapIterator()=default
Default destructor.
AllMapIterator & operator--() noexcept
Pre decrement operator.
Definition Map.h:159
MultiContainerIterator GetMultiContainerIterator() const noexcept
Method for get multi container iterator.
Definition Map.h:196
bool operator!=(const AllMapIterator &other) const noexcept
Not equal operator.
Definition Map.h:117
bool operator==(const AllMapIterator &other) const noexcept
Compare operator.
Definition Map.h:132
AllMapIterator(AllMapIterator &&other) noexcept
Deleted move constructor.
Definition Map.h:50
AllMapIterator(const MultiContainerIterator &dataMultiMapIt, const ContainerIterator &dataMapIt, const bool &isMultiMap) noexcept
Constructor.
Definition Map.h:64
iterator begin() noexcept
Begin provides access to the Data iterator.
Definition DataContainer.h:42
iterator end() noexcept
End provides access to the Data iterator.
Definition DataContainer.h:47
Specialization of class DataContainer, used as a type std::map<std::string, DataSaver>
Definition DataContainer.h:312
Specialization of class DataContainer, used as a type std::multimap<std::string, DataSaver>
Definition DataContainer.h:317
The descendant of the ParentMap class, which stores the map, i.e. the binary tree.
Definition Map.h:434
MapIterator< KeyType, ValueType > LowerBound(const KeyType &data) noexcept
Returns an iterator pointing to the first element that is not less than (i.e. greater or equal to) da...
Definition Map.h:454
ReverseMapIterator< KeyType, ValueType > Rbegin() noexcept
Reverse begin container method.
Definition Map.h:481
ReverseMapIterator< KeyType, ValueType > Rend() noexcept
Reverse end container method.
Definition Map.h:493
Map(const bool &isMultiMap) noexcept
Class constructor.
Definition Map.h:441
MapIterator< KeyType, ValueType > UpperBound(const KeyType &data) noexcept
Returns an iterator pointing to the first element that is greater than key.
Definition Map.h:469
Parent wrapper class for stl containers.
Definition Map.h:241
Iterator Erase(const Iterator &dataIt) noexcept
The method for erase data from Map with iterator.
Definition Map.h:391
std::pair< Iterator, Iterator > EqualRange(const KeyType &data) noexcept
The method for getting range of data.
Definition Map.h:331
std::pair< Iterator, bool > Emplace(EmplaceKeyType &&key, EmplaceValueType &&value) noexcept
The method for inserting data into the Map.
Definition Map.h:310
std::size_t Erase(const KeyType &data) noexcept
The method for erase data from Map with key.
Definition Map.h:373
bool IsMultiMap
Is this multi map.
Definition Map.h:244
void Clear() noexcept
The method for clear Map.
Definition Map.h:406
Iterator Find(const KeyType &data) noexcept
The method for getting iterator with key.
Definition Map.h:352
std::size_t Size() noexcept
The method for get Map size.
Definition Map.h:419
Iterator end() noexcept
End container method.
Definition Map.h:272
Iterator Begin() noexcept
Begin container method.
Definition Map.h:282
Iterator begin() noexcept
Begin container method.
Definition Map.h:260
Iterator End() noexcept
End container method.
Definition Map.h:292
The descendant of the ParentMap class, which stores the unordered_map, i.e. the hash table.
Definition Map.h:507
UnorderedMap(const bool &isMultiMap) noexcept
Class constructor.
Definition Map.h:514