|
|
|
|
|
by pixelesque
1210 days ago
|
|
Doesn't std::unique only generally work on consecutive items, and effectively requires the items to already be in a container (or at the very least have access to iterators to the items)? If so, that sounds fairly limiting to me (i.e. potential extra storage - of duplicates, sorting required, etc). |
|
But yes, you either need to stop occasionally and remove the duplicates or use a set, if the storage is prohibitive.
Otherwise in terms of performance, sorting and unique is much faster than inserting one element at a time in a set.