Following the answer in this thread "What's the most efficient way to erase duplicates and sort a vector?". I wrote the following code, but I got an error complaing no match for ‘operator<’ (operand types are ‘const connector’ and ‘const connector’)
blahblah...
connector
is a class I wrote myself, it basically is a line with two geometry points. uniqCntrs
is a std::vector. It has 100% duplicates in it, which means each element has a duplicate, the size of uniqCntrs
is quite big. What's wrong with my code, and how to deal with this situation?
std::set<connector> uniqCntrsSet;
for(unsigned int i = 0; i < uniqCntrs.size(); ++i )
{
uniqCntrsSet.insert(uniqCntrs[i]);
}
uniqCntrs.assign(uniqCntrsSet.begin(), uniqCntrsSet.end());
Edit:
I have no idea how to define <
operator for my connector class. I mean it is physically meaningless to say one line is smaller than the other.