A
Alex Vinokur
Here is some function that detects if a vector contains only different elements
bool vector_contains_only_different_elements (const vector<int>& v)
{
for (int i = 0; i < v.size(); i++)
{
if (count (v.begin() + i + 1, v.end(), v) >= 1) return false;
}
return true;
}
Is there more simple way to do the same thing?
bool vector_contains_only_different_elements (const vector<int>& v)
{
for (int i = 0; i < v.size(); i++)
{
if (count (v.begin() + i + 1, v.end(), v) >= 1) return false;
}
return true;
}
Is there more simple way to do the same thing?