Question: I don't want to change the vector or create a new vector with duplicates removed. I just want to check for duplicates, like:

```
{90, 80, 70, 60, 50, 40, 30, 20, 10, 10} -> true
{90, 89, 88, 87, 86, 85, 84, 83, 82, 81} -> false

```

Answer: 
Since your vector is sorted, you can check if two adjacent elements are equals :

```
for (auto it = vec.begin() + 1; it != vec.end(); ++it)
{
  if (vec[it] == vec[it - 1])
  {
    // duplicate
    return true;
  }
}
// no duplicate
return false;

```

You could also use [std::adjacent\_find](http://en.cppreference.com/w/cpp/algorithm/adjacent_find) which returns an iterator to the first element of the first duplicate in your vector:

```
auto it = std::adjacent_find(vec.begin(), vec.end());
if (it == vec.end())
{
  // no duplicate
  return false;
}
// duplicate
return true;

```
you can perform a linear search against all the elements in the vector. if it's a match, then u perform vector.erase(index)