19 #include "containers.h" 21 BEGIN_NAMESPACE_CONTAINERS
24 template <
typename KeyType,
typename ValueType>
29 enum class ConstTypeSwitch
35 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
38 using ValType = ValueType;
39 using PointeeType =
typename std::vector<std::pair<KeyType, ValueType>>::iterator;
42 template <
typename KeyType,
typename ValueType>
45 using ValType =
const ValueType;
46 using PointeeType =
typename std::vector<std::pair<KeyType, ValueType>>::const_iterator;
49 template <
typename KeyType,
typename ValueType>
52 using ValType = ValueType;
53 using PointeeType =
typename std::vector<std::pair<KeyType, ValueType>>::iterator;
56 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
62 using ValType =
typename UnderlyingTypes<KeyType, ValueType, ConstSwitch>::ValType;
63 using PointeeType =
typename UnderlyingTypes<KeyType, ValueType, ConstSwitch>::PointeeType;
65 using iterator_category = std::forward_iterator_tag;
66 using value_type = ValType;
67 using difference_type = std::ptrdiff_t;
68 using pointer = ValType*;
69 using reference = ValType&;
76 const KeyType&
getKey()
const;
129 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
132 return pointee->first;
135 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
139 return pointee->second;
142 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
146 return &(pointee->second);
149 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
156 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
161 return previousState;
164 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
170 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
174 return pointee == other.pointee;
177 template <
typename KeyType,
typename ValueType, ConstTypeSwitch ConstSwitch>
181 return pointee != other.pointee;
186 END_NAMESPACE_CONTAINERS
bool operator==(const VectorWithKeysIterator< KeyType, ValueType, ConstSwitch > &other) const
Check if iterators point to the same element in the container.
Definition: vector_with_keys_iterator.h:171
VectorWithKeysIterator< KeyType, ValueType, ConstSwitch > operator+(int32_t increment)
Increment iterator to by the number of elements passed as an increment.
Definition: vector_with_keys_iterator.h:165
ValType * operator->()
Definition: vector_with_keys_iterator.h:144
Definition: vector_with_keys.h:27
Definition: vector_with_keys_iterator.h:36
Definition: vector_with_keys_iterator.h:27
const VectorWithKeysIterator< KeyType, ValueType, ConstSwitch > & operator++()
Post increment iterator to the next element in container.
Definition: vector_with_keys_iterator.h:150
const KeyType & getKey() const
Definition: vector_with_keys_iterator.h:130
Definition: vector_with_keys_iterator.h:57
ValType & operator*()
Definition: vector_with_keys_iterator.h:137
bool operator!=(const VectorWithKeysIterator< KeyType, ValueType, ConstSwitch > &other) const
Check if iterators don't point to the same element in the container.
Definition: vector_with_keys_iterator.h:178