I am surprise that there is no std::is_unique in the algoritm part of the STL.
I've workaround the value with std::unique_copy but I found that poor because it performs memory allocation when I really just need to know if there are duplicated values.
I am aware of the alternative solution consisting of iterating over while inserting into an std::set to find duplicate but same story.
Is there an efficient, elegant (i.e : one liner using only std algorithms) solution ?
std::vector<std::string> elements = { "foo", "bar", "foo"} ;
std::vector<std::string> uniquified;
std::unique_copy(cbegin(elements),cend(elements), std::back_inserter(uniquified));
if (uniquified.size() != elements.size())
return "Elements are not unique";