13 #ifndef __STOUT_LINKEDHASHMAP_HPP__    14 #define __STOUT_LINKEDHASHMAP_HPP__    28 template <
typename Key, 
typename Value>
    32   typedef std::pair<Key, Value> 
entry;
    33   typedef std::list<entry> 
list;
    39     : entries_(other.entries_)
    42     for (
auto it = entries_.begin(); it != entries_.end(); ++it) {
    43       keys_[it->first] = it;
    52       entries_ = other.entries_;
    55       for (
auto it = entries_.begin(); it != entries_.end(); ++it) {
    56         keys_[it->first] = it;
    72       typename list::iterator iter =
    73         entries_.insert(entries_.end(), std::make_pair(key, Value()));
    78     return keys_[key]->second;
    84       return keys_.at(key)->second;
    89   Value& 
at(
const Key& key)
    91     return keys_.at(key)->second;
    94   const Value& 
at(
const Key& key)
 const    96     return keys_.at(key)->second;
   107       typename list::iterator iter = keys_[key];
   109       entries_.erase(iter);
   118     std::vector<Key> result;
   119     result.reserve(entries_.size());
   121     foreach (
const entry& entry, entries_) {
   122       result.push_back(entry.first);
   131     std::vector<Value> result;
   132     result.reserve(entries_.size());
   134     foreach (
const entry& entry, entries_) {
   135       result.push_back(entry.second);
   148     return keys_.empty();
   160   typename list::iterator 
begin() { 
return entries_.begin(); }
   161   typename list::iterator 
end() { 
return entries_.end(); }
   163   typename list::const_iterator 
begin()
 const { 
return entries_.cbegin(); }
   164   typename list::const_iterator 
end()
 const { 
return entries_.cend(); }
   172 #endif // __STOUT_LINKEDHASHMAP_HPP__ bool empty() const 
Definition: linkedhashmap.hpp:146
Definition: option.hpp:29
const Value & at(const Key &key) const 
Definition: linkedhashmap.hpp:94
LinkedHashMap(const LinkedHashMap< Key, Value > &other)
Definition: linkedhashmap.hpp:38
std::pair< Key, Value > entry
Definition: linkedhashmap.hpp:32
list::const_iterator begin() const 
Definition: linkedhashmap.hpp:163
size_t size() const 
Definition: linkedhashmap.hpp:141
std::vector< Key > keys() const 
Definition: linkedhashmap.hpp:116
list::const_iterator end() const 
Definition: linkedhashmap.hpp:164
std::vector< Value > values() const 
Definition: linkedhashmap.hpp:129
size_t erase(const Key &key)
Definition: linkedhashmap.hpp:104
hashmap< Key, typename list::iterator > map
Definition: linkedhashmap.hpp:34
list::iterator begin()
Definition: linkedhashmap.hpp:160
Value & at(const Key &key)
Definition: linkedhashmap.hpp:89
Value & operator[](const Key &key)
Definition: linkedhashmap.hpp:67
LinkedHashMap & operator=(const LinkedHashMap< Key, Value > &other)
Definition: linkedhashmap.hpp:47
void clear()
Definition: linkedhashmap.hpp:151
Definition: linkedhashmap.hpp:29
bool contains(const Key &key) const 
Definition: linkedhashmap.hpp:99
bool contains(const Key &key) const 
Definition: hashmap.hpp:86
list::iterator end()
Definition: linkedhashmap.hpp:161
std::list< entry > list
Definition: linkedhashmap.hpp:33