Using STL algorithms (as much as possible) such as remove_if() and list::erase, is there a nice way to remove duplicates from a list defined as fol
remove_if()
list::erase
Using the list::remove_if member function, a temporary hashed set, and lambda expression.
list::remove_if
std::list l; std::unordered_set s; l.remove_if([&](int n) { return (s.find(n) == s.end()) ? (s.insert(n), false) : true; });