diff options
Diffstat (limited to 'source/blender/blenlib/BLI_vector.hh')
-rw-r--r-- | source/blender/blenlib/BLI_vector.hh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index d07c9aeeb3d..cba58945546 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -805,6 +805,17 @@ class Vector { } /** + * Remove all values for which the given predicate is true. + * + * This is similar to std::erase_if. + */ + template<typename Predicate> void remove_if(Predicate &&predicate) + { + end_ = std::remove_if(this->begin(), this->end(), predicate); + UPDATE_VECTOR_SIZE(this); + } + + /** * Do a linear search to find the value in the vector. * When found, return the first index, otherwise return -1. */ |