If you have a std::list, you're supposed to call list.remove_if(predicate), and not std::remove_if(list, predicate).
That's because shuffling around the nodes of the list can be much much cheaper than shuffling around the contents of those nodes.
To cope with these differences, C++20 introduced free erase and erase_if functions, which I have also added to Qt containers.
remove/remove_if (or erase, cf #7 ) should therefore have some dispatching logic inside:
- if you can call (through ADL!)
erase(container, ...) or erase_if(container, ...) then do that
- otherwise do the erase/remove idiom