You can also return/use a THashTable  .... to avoid the end result copy ...  actually I am not sure what is the 'performance' issue the std::set is suppose to resolve ... the number of elements in the resulting list should be 'low' in the general case ...