One equal value in 2 different ranges

Hi there!

I'm looking for algorithm which tests whether is at least one equal value in two different ranges (for example in two vectors).

Do you know any ?

Thanks for your help ;)
You can try find_first_of http://www.cplusplus.com/reference/algorithm/find_first_of/
Or use two nested loops and write your own
You can do this in about five lines of code, if you know the algorithms.

First, sort the two vectors using std::sort().
(Alternatively, make std::set<>s out of them.)
Next, use std::set_intersection algorithm on the two vectors.
If the intersection is empty, then there were no duplicate values.
Topic archived. No new replies allowed.