8 #ifndef SERVLET_LINKED_HASH_MAP_H 
    9 #define SERVLET_LINKED_HASH_MAP_H 
   12 #include <unordered_map> 
   16 #include <experimental/any> 
   56 template<
typename _Key, 
typename _Tp, 
typename _MT>
 
  177     bool empty() const noexcept { 
return _map.empty(); }
 
  192     template<
typename KeyType>
 
  193     bool contains_key(
const KeyType &key)
 const { 
return _map.find(key) != _map.end(); }
 
  221     template<
typename KeyType>
 
  224         auto it = _map.find(key);
 
  226         _list.splice(_list.cend(), _list, it->second);
 
  244     template<
typename KeyType>
 
  247         auto it = _map.find(key);
 
  249         _list.splice(_list.cend(), _list, it->second);
 
  265     template<
class... Args>
 
  268         auto it = _map.find(key);
 
  269         bool found = it != _map.end();
 
  272             _list.splice(_list.cend(), _list, it->second);
 
  273             it->second->second = 
mapped_type{std::forward<Args>(args)...};
 
  277             auto pr = _map.emplace(std::move(key), _list.begin());
 
  278             _list.emplace_back(std::piecewise_construct,
 
  279                                std::forward_as_tuple(pr.first->first),
 
  280                                std::forward_as_tuple(std::forward<Args>(args)...));
 
  281             pr.first->second = --_list.end();
 
  297     template<
class... Args>
 
  300         auto it = _map.find(key);
 
  301         bool found = it != _map.end();
 
  304             _list.splice(_list.cend(), _list, it->second);
 
  305             it->second->second = 
mapped_type{std::forward<Args>(args)...};
 
  309             auto pr = _map.emplace(key, _list.begin());
 
  310             _list.emplace_back(std::piecewise_construct,
 
  311                                std::forward_as_tuple(pr.first->first),
 
  312                                std::forward_as_tuple(std::forward<Args>(args)...));
 
  313             pr.first->second = --_list.end();
 
  330     template<
class... Args>
 
  333         auto it = _map.find(key);
 
  334         if (it != _map.end()) 
return false;
 
  335         auto pr = _map.emplace(std::move(key), _list.begin());
 
  336         _list.emplace_back(std::piecewise_construct,
 
  337                            std::forward_as_tuple(pr.first->first),
 
  338                            std::forward_as_tuple(std::forward<Args>(args)...));
 
  339         pr.first->second = --_list.end();
 
  354     template<
class... Args>
 
  357         auto it = _map.find(key);
 
  358         if (it != _map.end()) 
return false;
 
  359         auto pr = _map.emplace(key, _list.begin());
 
  360         _list.emplace_back(std::piecewise_construct,
 
  361                            std::forward_as_tuple(pr.first->first),
 
  362                            std::forward_as_tuple(std::forward<Args>(args)...));
 
  363         pr.first->second = --_list.end();
 
  380     template<
typename KeyType>
 
  383         auto it = _map.find(key);
 
  384         if (it == _map.end()) 
return false;
 
  385         _list.erase(it->second);
 
  519 template <
typename _Key, 
typename _Value, 
typename _Compare = std::less<>,
 
  520           typename _Alloc = std::allocator<std::pair<const _Key,
 
  521                                                      typename std::list<std::pair<const _Key&, _Value>>::iterator>>>
 
  522 using linked_tree_map = 
linked_map<_Key, _Value,
 
  523                                    std::map<_Key, typename std::list<std::pair<const _Key&, _Value>>
::iterator,
 
  529 template <
typename _Key, 
typename _Value, 
typename _Hash = std::hash<_Key>,
 
  530           typename _Pred = std::equal_to<_Key>,
 
  531           typename _Alloc = std::allocator<std::pair<const _Key,
 
  532                                                      typename std::list<std::pair<const _Key&, _Value>>::iterator>>>
 
  533 using linked_hash_map = 
linked_map<_Key, _Value,
 
  534                                    std::unordered_map<_Key, typename std::list<std::pair<const _Key&, _Value>>
::iterator,
 
  535                                                       _Hash, _Pred, _Alloc>>;
 
  539 #endif // SERVLET_LINKED_HASH_MAP_H 
map_type::difference_type difference_type
A signed integral type to represent distance between iterators. 
Definition: linked_map.h:113
linked_map & operator=(const linked_map &m)=default
The copy assignment. 
Defines optional container objects and related methods. 
map_type::size_type size_type
An unsigned integral type to represent the size of this container. 
Definition: linked_map.h:109
virtual void purge()
Removes elements which do not confirm to the storage criteria from the container. ...
Definition: linked_map.h:509
linked_map< _Key, _Tp, _MT > self_type
The type of this container. 
Definition: linked_map.h:76
std::list< value_type > list_type
List type to maintain the order of elements. 
Definition: linked_map.h:80
list_type::iterator iterator
Bidirectional iterator type. 
Definition: linked_map.h:118
bool try_put(const key_type &key, Args &&...args)
Associates a value of specified type created with a given arguments with the specified key in this ma...
Definition: linked_map.h:355
const_reverse_iterator rend() const noexcept
Return constant reverse iterator to reverse end. 
Definition: linked_map.h:471
bool put(const key_type &key, Args &&...args)
Associates a value of specified type created with a given arguments with the specified key in this ma...
Definition: linked_map.h:298
Optional reference implementation. 
Definition: optional.h:221
reverse_iterator rbegin() noexcept
Return reverse iterator to reverse beginning. 
Definition: linked_map.h:446
bool contains_key(const KeyType &key) const 
Tests whether value with a given key exists in this container. 
Definition: linked_map.h:193
const_iterator cbegin() const noexcept
Returns constant iterator to beginning of the container. 
Definition: linked_map.h:429
const_iterator cend() const noexcept
Return constant iterator to end of the container. 
Definition: linked_map.h:436
bool erase(const KeyType &key)
Erase element. 
Definition: linked_map.h:381
const value_type * const_pointer
Constant pointer to value_type type. 
Definition: linked_map.h:105
Implementation of linked associative container. 
Definition: linked_map.h:57
value_type & reference
value_type& 
Definition: linked_map.h:93
list_type::reverse_iterator reverse_iterator
Reverse iterator type. 
Definition: linked_map.h:126
linked_map()=default
Constructs an empty container, with no elements. 
iterator end() noexcept
Return iterator to end of the container. 
Definition: linked_map.h:405
const_iterator begin() const noexcept
Returns constant iterator to beginning of the container. 
Definition: linked_map.h:413
const_reverse_iterator crbegin() const noexcept
Return constant reverse iterator to reverse beginning. 
Definition: linked_map.h:481
const_reverse_iterator rbegin() const noexcept
Return constant reverse iterator to reverse beginning. 
Definition: linked_map.h:463
std::pair< const _Key &, _Tp > value_type
Container's value type: std::pair<const key_type&, mapped_type> 
Definition: linked_map.h:71
map_type::allocator_type allocator_type
Container's allocator type. 
Definition: linked_map.h:89
bool try_put(key_type &&key, Args &&...args)
Associates a value of specified type created with a given arguments with the specified key in this ma...
Definition: linked_map.h:331
value_type * pointer
Pointer to value_type type. 
Definition: linked_map.h:101
bool empty() const noexcept
Test whether container is empty. 
Definition: linked_map.h:177
const value_type & const_reference
const value_type& 
Definition: linked_map.h:97
list_type::const_reverse_iterator const_reverse_iterator
Constant reverse iterator type. 
Definition: linked_map.h:130
list_type::const_iterator const_iterator
Bidirectional constant iterator type. 
Definition: linked_map.h:122
_MT map_type
Underlying map type. 
Definition: linked_map.h:84
virtual void update(value_type &val) const 
Updates element on access. 
Definition: linked_map.h:501
size_type size() const noexcept
Returns the number of elements in the container. 
Definition: linked_map.h:182
_Key key_type
Container's key type. 
Definition: linked_map.h:63
_Tp mapped_type
Container's mapped type. 
Definition: linked_map.h:67
const_reverse_iterator crend() const noexcept
Return constant reverse iterator to reverse end. 
Definition: linked_map.h:489
bool put(key_type &&key, Args &&...args)
Associates a value of specified type created with a given arguments with the specified key in this ma...
Definition: linked_map.h:266
void clear()
Clear content. 
Definition: linked_map.h:201
iterator begin() noexcept
Returns iterator to beginning of the container. 
Definition: linked_map.h:398
const_iterator end() const noexcept
Return constant iterator to end of the container. 
Definition: linked_map.h:420
reverse_iterator rend() noexcept
Return reverse iterator to reverse end. 
Definition: linked_map.h:454