jeudi 3 août 2017

Finding elements of std::vector in std::set

I have two containers std::set and std::vector and my task is to return elements from std::vector which are present in std::set. What is the most effective way to achieve it? Simple solution: Iterate through elements of vector and call set.find on each and then vector.erase if not found.

Thank you and regards, /Lukasz

Aucun commentaire:

Enregistrer un commentaire