|
@@ -789,8 +789,25 @@ public:
|
|
|
size_type remove(It first, It last) {
|
|
size_type remove(It first, It last) {
|
|
|
size_type count{};
|
|
size_type count{};
|
|
|
|
|
|
|
|
- for(; first != last; ++first) {
|
|
|
|
|
- count += remove(*first);
|
|
|
|
|
|
|
+ if constexpr(std::is_same_v<It, basic_iterator>) {
|
|
|
|
|
+ while(first != last) {
|
|
|
|
|
+ while(first != last && !contains(*first)) {
|
|
|
|
|
+ ++first;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const auto it = first;
|
|
|
|
|
+
|
|
|
|
|
+ while(first != last && contains(*first)) {
|
|
|
|
|
+ ++first;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ count += std::distance(it, first);
|
|
|
|
|
+ erase(it, first);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for(; first != last; ++first) {
|
|
|
|
|
+ count += remove(*first);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
return count;
|