non-sorting std::set ?

G

Gernot Frisch

er... I need a class that keeps the order of the elements, but does
not allow duplicates to be inserted.
 
M

Mike Wahler

Gernot Frisch said:
er... I need a class that keeps the order of the elements, but does not
allow duplicates to be inserted.

That's what 'std::set' does ('std::multiset' allows
duplicates). BTW tyur question does not correspond to your
subject line: "non-sorting std::set".

-Mike
 
G

Gernot Frisch

Mike Wahler said:
That's what 'std::set' does ('std::multiset' allows
duplicates). BTW tyur question does not correspond to your
subject line: "non-sorting std::set".

Er... I thought std::set (and atd::map) will sort the data, so finding
if the item already is in the list works fater. Also, what would you
be able to provide a "sort struct" as 3rd constructor parameter for?
-Gernot
 
M

Mike Wahler

Gernot Frisch said:
Er... I thought std::set (and atd::map) will sort the data,

Correct. I thought that's what you meant by 'keeps the order of the
elements'.
so finding if the item already is in the list works fater.

Faster than what?
Also, what would you be able to provide a "sort struct" as 3rd constructor
parameter for?

I presume you're talking about the 'predicate' argument. This
is for you to define your own meaning to ordering (specifically
the meaning of 'less than').

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top