1 #ifndef TTKUNSORTEDMAP_H
2 #define TTKUNSORTEDMAP_H
24 #ifndef _CONSTEXPR_CONTAINER
26 # define _CONSTEXPR_CONTAINER _CONSTEXPR20_CONTAINER
28 # define _CONSTEXPR_CONTAINER inline
36 template <
class _Key,
class _Value>
49 using iterator =
typename _Container::iterator;
59 template <
class _Iter>
98 template <class _Iter = iterator, typename std::enable_if<!std::is_same<_Iter, const_iterator>::value,
int>::type = 0>
116 const auto &iter =
find(_Keyval);
192 if(item.first == _Keyval)
198 m_conatiner.emplace_back(std::move(std::make_pair(_Keyval,
mapped_type())));
199 return m_conatiner.back().second;
211 if(item.first == _Keyval)
217 throw(
"invalid map<K, T> key");
218 return m_conatiner.end()->second;
223 for(
auto itr =
begin(); itr !=
end(); ++itr)
225 if(itr->first == _Keyval)
236 for(
auto itr =
begin(); itr !=
end(); ++itr)
238 if(itr->first == _Keyval)
249 return find(_Keyval) !=
end() ? 1 : 0;
261 return find(_Keyval);
266 return find(_Keyval);
271 auto iter =
find(_Keyval);
272 return iter !=
end() ? (++iter !=
end() ? iter :
end()) :
end();
277 auto iter =
find(_Keyval);
278 return iter !=
end() ? (++iter !=
end() ? iter :
end()) :
end();
283 const auto &iter =
find(_Keyval);
286 const auto &next = std::next(iter);
289 return { iter, next };
293 return { iter,
end() };
302 const auto &iter =
find(_Keyval);
305 const auto &next = std::next(iter);
308 return { iter, next };
312 return { iter,
end() };
320 template <
class... _Valtys>
324 _container.emplace_back(std::forward<_Valtys>(_Vals)...);
326 const auto &iter =
find(_container.begin()->first);
329 return { iter,
false };
332 m_conatiner.emplace_back(std::move(_container.front()));
336 template <
class... _Valtys>
340 _container.emplace_back(std::forward<_Valtys>(_Vals)...);
342 const auto &iter =
find(_container.begin()->first);
348 return m_conatiner.emplace(_Where, std::move(_container.front()));
354 auto iter =
find(_Val.first);
366 auto iter =
find(_Val.first);
378 auto iter =
find(_Val.first);
389 auto iter =
find(_Val.first);
395 return m_conatiner.emplace(_Where, std::move(_Val));
398 template <
class _Iter>
401 _Adl_verify_range(_First, _Last);
402 auto _UFirst = _Get_unwrapped(_First);
403 const auto _ULast = _Get_unwrapped(_Last);
405 for(; _UFirst != _ULast; ++_UFirst)
413 insert(_Ilist.begin(), _Ilist.end());
426 template <
class _Key,
class _Value>
432 template <
class _Key,
class _Value>
436 #endif // TTKUNSORTEDMAP_H
_CONSTEXPR_CONTAINER const_iterator find(const key_type &_Keyval) const noexcept
std::pair< key_type, _Value > value_type
_CONSTEXPR_CONTAINER TTKUnsortedMap(TTKUnsortedMap &&_Right) noexcept
_CONSTEXPR_CONTAINER iterator end() noexcept
_CONSTEXPR_CONTAINER size_type size() const noexcept
_CONSTEXPR_CONTAINER void clear() noexcept
typename _Container::reverse_iterator reverse_iterator
_CONSTEXPR_CONTAINER const_reference at(const key_type &_Keyval) const
typename _Container::size_type size_type
std::vector< value_type > _Container
_CONSTEXPR_CONTAINER iterator insert(const_iterator _Where, value_type &&_Val)
_CONSTEXPR_CONTAINER iterator begin() noexcept
_CONSTEXPR_CONTAINER std::pair< iterator, bool > emplace(_Valtys &&..._Vals)
_CONSTEXPR_CONTAINER iterator upper_bound(const key_type &_Keyval) noexcept
void swap(TTKAny &left, TTKAny &right) noexcept
_CONSTEXPR_CONTAINER iterator erase(iterator _Where) noexcept
_CONSTEXPR_CONTAINER const_iterator cend() const noexcept
_CONSTEXPR_CONTAINER reverse_iterator rbegin() noexcept
_CONSTEXPR_CONTAINER const_reverse_iterator crend() const noexcept
_CONSTEXPR_CONTAINER TTKUnsortedMap & operator=(const TTKUnsortedMap &_Right) noexcept
_CONSTEXPR_CONTAINER const_reverse_iterator rbegin() const noexcept
_CONSTEXPR_CONTAINER void swap(TTKUnsortedMap &_Right) noexcept
_CONSTEXPR_CONTAINER iterator emplace_hint(const_iterator _Where, _Valtys &&..._Vals)
_CONSTEXPR_CONTAINER const_reverse_iterator crbegin() const noexcept
The class of the ttk unsorted map module.
typename _Container::const_iterator const_iterator
_CONSTEXPR_CONTAINER iterator erase(const_iterator _First, const_iterator _Last) noexcept
typename _Container::const_reverse_iterator const_reverse_iterator
_CONSTEXPR_CONTAINER size_type count(const key_type &_Keyval) const noexcept
_CONSTEXPR_CONTAINER TTKUnsortedMap(const TTKUnsortedMap &_Right) noexcept
_CONSTEXPR_CONTAINER reference at(const key_type &_Keyval)
_CONSTEXPR_CONTAINER const_iterator lower_bound(const key_type &_Keyval) const noexcept
_CONSTEXPR_CONTAINER const_iterator upper_bound(const key_type &_Keyval) const noexcept
_CONSTEXPR_CONTAINER bool empty() const noexcept
_CONSTEXPR_CONTAINER const_reverse_iterator rend() const noexcept
_CONSTEXPR_CONTAINER const_iterator cbegin() const noexcept
_CONSTEXPR_CONTAINER iterator erase(const_iterator _Where) noexcept
_CONSTEXPR_CONTAINER iterator find(const key_type &_Keyval) noexcept
_CONSTEXPR_CONTAINER reference operator[](const key_type &_Keyval)
_CONSTEXPR_CONTAINER iterator insert(value_type &&_Val)
const _Value & const_reference
_CONSTEXPR_CONTAINER iterator lower_bound(const key_type &_Keyval) noexcept
_CONSTEXPR_CONTAINER TTKUnsortedMap() noexcept
typename _Container::iterator iterator
_CONSTEXPR_CONTAINER std::pair< const_iterator, const_iterator > equal_range(const key_type &_Keyval) const noexcept
_CONSTEXPR_CONTAINER size_type erase(const key_type &_Keyval) noexcept
#define _CONSTEXPR_CONTAINER
_CONSTEXPR_CONTAINER reverse_iterator rend() noexcept
_CONSTEXPR_CONTAINER const_iterator end() const noexcept
_CONSTEXPR_CONTAINER iterator insert(const value_type &_Val)
_CONSTEXPR_CONTAINER TTKUnsortedMap & operator=(TTKUnsortedMap &&_Right) noexcept
_CONSTEXPR_CONTAINER void insert(std::initializer_list< value_type > _Ilist)
_CONSTEXPR_CONTAINER void insert(_Iter _First, _Iter _Last)
_CONSTEXPR_CONTAINER std::pair< iterator, iterator > equal_range(const key_type &_Keyval) noexcept
_CONSTEXPR_CONTAINER TTKUnsortedMap(_Iter _First, _Iter _Last) noexcept
_CONSTEXPR_CONTAINER const_iterator begin() const noexcept
_CONSTEXPR_CONTAINER iterator insert(const_iterator _Where, const value_type &_Val)