diff options
Diffstat (limited to 'core/templates/local_vector.h')
-rw-r--r-- | core/templates/local_vector.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h index 6478297fd1..e0047e0782 100644 --- a/core/templates/local_vector.h +++ b/core/templates/local_vector.h @@ -104,6 +104,22 @@ public: return false; } + U erase_multiple_unordered(const T &p_val) { + U from = 0; + U occurrences = 0; + while (true) { + int64_t idx = find(p_val, from); + + if (idx == -1) { + break; + } + remove_at_unordered(idx); + from = idx; + occurrences++; + } + return occurrences; + } + void invert() { for (U i = 0; i < count / 2; i++) { SWAP(data[i], data[count - i - 1]); |