@@ -26,9 +26,11 @@ class OrderedMap
2626
2727 bool IsEmpty () const ;
2828 bool Contains (const Key& key) const ;
29- const Value& GetValue (const Key& key) const ;
3029 size_t Count () const ;
3130
31+ Value& GetValue (const Key& key);
32+ const Value& GetValue (const Key& key) const ;
33+
3234 bool Insert (const Key& key, const Value& value);
3335 bool InsertBefore (const Key& key, const Value& value, const Key& nextKey);
3436 bool InsertAfter (const Key& key, const Value& value, const Key& prevKey);
@@ -117,17 +119,25 @@ bool OrderedMap<Key, Value>::Contains (const Key& key) const
117119}
118120
119121template <typename Key, typename Value>
120- const Value& OrderedMap<Key, Value>::GetValue ( const Key& key ) const
122+ size_t OrderedMap<Key, Value>::Count ( ) const
121123{
122- const Iterator& iterator = keyToValueMap.at (key);
123- const KeyValue& keyValue = *iterator;
124+ return keyToValueMap.size ();
125+ }
126+
127+ template <typename Key, typename Value>
128+ Value& OrderedMap<Key, Value>::GetValue (const Key& key)
129+ {
130+ Iterator& iterator = keyToValueMap.at (key);
131+ KeyValue& keyValue = *iterator;
124132 return keyValue.second ;
125133}
126134
127135template <typename Key, typename Value>
128- size_t OrderedMap<Key, Value>::Count ( ) const
136+ const Value& OrderedMap<Key, Value>::GetValue ( const Key& key ) const
129137{
130- return keyToValueMap.size ();
138+ const Iterator& iterator = keyToValueMap.at (key);
139+ const KeyValue& keyValue = *iterator;
140+ return keyValue.second ;
131141}
132142
133143template <typename Key, typename Value>
0 commit comments