He Shiming wrote:
> Hi, thank you both for the answer. But, the reason why I'm using std::set
> here is because it need to avoid duplicated values. And actual concept of
> this string-value pair is "a collection (set) of values". I'm afraid that if
> I go with std::list or std::vector, I'll need to do a lot of extra
> duplication-check. Does deque have an internal optimization on it? Or is
> there any other suggestions?
>
I am not sure I understand your hesitation to use 'list' or 'vector' to
_supplement_ 'set':
std::set<whatever> set_of_whatever;
std::list<std::set<whatever>::iterator> order_of_insertion;
std:

air<std::set<whatever>::iterator,bool> done =
set_of_whatever.insert(a_whatever);
if (done.second) // if insertion occurred
order_of_insertion.push_back(done.first); // store the location
std::set::insert returns a value, you should take advantage of that.
Victor