Exemplo n.º 1
0
 void erase_if_dispatch(AssociativeContainer& c, Predicate p,
                        associative_container_tag, stable_tag)
 {
   typename AssociativeContainer::iterator i, next;
   for (i = next = c.begin(); next != c.end(); i = next) {
     ++next;
     if (p(*i))
       c.erase(i);
   }
 }
void remove_if(AssociativeContainer& C, Predicate p)
{
	typedef typename AssociativeContainer::iterator iterator;

	iterator cur = C.begin();
	const iterator last = C.end();

	while ((cur = std::find_if(cur, last, p)) != last)
	{
		iterator tmp = cur++;
		C.erase(tmp);
	}
}
Exemplo n.º 3
0
 void erase_if_dispatch(AssociativeContainer& c, Predicate p,
                        associative_container_tag, unstable_tag)
 {
   // This method is really slow, so hopefully we won't have any
   // associative containers with unstable iterators!
   // Is there a better way to do this?
   typename AssociativeContainer::iterator i;
   typename AssociativeContainer::size_type n = c.size();
   while (n--)
     for (i = c.begin(); i != c.end(); ++i)
       if (p(*i)) {
         c.erase(i);
         break;
       }
 }
Exemplo n.º 4
0
 void erase_dispatch(AssociativeContainer& c, const T& x, 
                     associative_container_tag)
 {
   c.erase(x);
 }
Exemplo n.º 5
0
 void erase_certainties(AssociativeContainer& c) {
   BOOST_FOREACH(const Card& card, fixed_) {
     c.erase(card);
   }