const std::list< Pair<K, V> >* find(const K& key) { std::list< Pair<K, V> >* new_liste = new std::list< Pair<K, V> >(); typename std::list<Pair<K, V> >::iterator debut = _liste.begin(); typename std::list<Pair<K, V > >::iterator fin = _liste.end(); for (; debut != fin; ++debut) { if (debut->getKey() == key) { Pair<K, V> p(debut->getKey(), debut->getValue()); new_liste->push_back(p); } } return new_liste; }
void erase(const K& key) { typename std::list<Pair<K, V> >::iterator debut = _liste.begin(); typename std::list<Pair<K, V > >::iterator fin = _liste.end(); for ( ; debut != fin; ++debut) { if (key == debut->getKey()) _liste.erase(debut); } }
unsigned long count(const K& key) { unsigned long tot = 0; typename std::list<Pair<K, V> >::iterator debut = _liste.begin(); typename std::list<Pair<K, V > >::iterator fin = _liste.end(); for (; debut != fin; ++debut) { if (key == debut->getKey()) tot++; } return tot; }