Skip to content

Commit

Permalink
COMMON: Fix PtrList::remove() and ::remove_if()
Browse files Browse the repository at this point in the history
No idea how that happened...
  • Loading branch information
DrMcCoy committed Dec 22, 2016
1 parent c4a68b9 commit f4aaa7a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common/ptrlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,21 @@ class PtrList : boost::noncopyable, public std::list<T *> {
}

void remove(const typename std::list<T *>::value_type &val) {
for (typename std::list<T *>::iterator it = std::list<T *>::begin(); it != std::list<T *>::end(); ++it) {
for (typename std::list<T *>::iterator it = std::list<T *>::begin(); it != std::list<T *>::end(); ) {
if (*it == val)
it = erase(it);
else
++it;
++it;
}
}

template<class Predicate>
void remove_if(Predicate pred) {
for (typename std::list<T *>::iterator it = std::list<T *>::begin(); it != std::list<T *>::end(); ++it) {
for (typename std::list<T *>::iterator it = std::list<T *>::begin(); it != std::list<T *>::end(); ) {
if (pred(*it))
it = erase(it);
else
++it;
++it;
}
}

Expand Down

0 comments on commit f4aaa7a

Please sign in to comment.