Checking for duplicates in a vector

Posted by xbonez on Stack Overflow See other posts from Stack Overflow or by xbonez
Published on 2010-05-18T19:56:09Z Indexed on 2010/05/18 20:00 UTC
Read the original article Hit count: 257

Filed under:

I have to check a vector for duplicates. What is the best way to approach this:

I take the first element, compare it against all other elements in the vector. Then take the next element and do the same and so on.

Is this the best way to do it, or is there a more efficient way to check for dups?

© Stack Overflow or respective owner

Related posts about c++