Example #1
0
  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;
  }
Example #2
0
  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);
      }
  }
Example #3
0
  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;
  }