diff --git a/src/util/list_fn.h b/src/util/list_fn.h index 3178be61f..246c62f0f 100644 --- a/src/util/list_fn.h +++ b/src/util/list_fn.h @@ -176,6 +176,12 @@ list filter(list const & l, P && p) { } } +/** \brief Remove all occurrences of \c a from \c l */ +template +list remove(list const & l, T const & a) { + return filter(l, [&](T const & v) { return a != v; }); +} + /** \brief Remove the last element that satisfies \c p. */ template list remove_last(list const & l, P && p) {