checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::hasOnlyUniqueValues: must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
- std::set<int> s; // in C++11, should use unordered_set (O(1) complexity)
- int nbOfTuples=getNumberOfTuples();
- const int *w=getConstPointer();
- const int *end2=w+nbOfTuples;
- for(;w!=end2;w++)
- s.insert(*w);
+ int nbOfTuples(getNumberOfTuples());
+ std::set<int> s(begin(),end()); // in C++11, should use unordered_set (O(1) complexity)
if (s.size() != nbOfTuples)
return false;
return true;