We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
remove
remove_if
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you have a std::list, you're supposed to call list.remove_if(predicate), and not std::remove_if(list, predicate).
std::list
list.remove_if(predicate)
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.
erase
erase_if
remove/remove_if (or erase, cf #7 ) should therefore have some dispatching logic inside:
erase(container, ...)
erase_if(container, ...)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If you have a
std::list
, you're supposed to calllist.remove_if(predicate)
, and notstd::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
anderase_if
functions, which I have also added to Qt containers.remove
/remove_if
(orerase
, cf #7 ) should therefore have some dispatching logic inside:erase(container, ...)
orerase_if(container, ...)
then do thatThe text was updated successfully, but these errors were encountered: