diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 0ab42ee7ca..6d248f0769 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -95,6 +95,18 @@ void CircularShift( vector &v, int dist ) } } +/* + * Helper function to remove all objects from an STL container for which the + * Predicate pred is true. If you want to remove all objects for which the predicate + * returns false, wrap the predicate with not1(). + */ +template +inline void RemoveIf( Container& c, Predicate p ) +{ + c.erase( remove_if(c.begin(), c.end(), p), c.end() ); +} + + /* * We only have unsigned swaps; byte swapping a signed value doesn't make sense. *