By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

non-sorting std::set ?

P: n/a
er... I need a class that keeps the order of the elements, but does
not allow duplicates to be inserted.
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


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


See http://www.boost.org/libs/multi_index/doc/index.html

Jeff Flinn
Jul 23 '05 #2

P: n/a

"Gernot Frisch" <Me@Privacy.net> wrote in message
news:3c*************@individual.net...
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
Jul 23 '05 #3

P: n/a

"Mike Wahler" <mk******@mkwahler.net> schrieb im Newsbeitrag
news:t4*****************@newsread1.news.pas.earthl ink.net...

"Gernot Frisch" <Me@Privacy.net> wrote in message
news:3c*************@individual.net...
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".


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
Jul 23 '05 #4

P: n/a

"Gernot Frisch" <Me@Privacy.net> wrote in message
news:3c*************@individual.net...

"Mike Wahler" <mk******@mkwahler.net> schrieb im Newsbeitrag
news:t4*****************@newsread1.news.pas.earthl ink.net...

"Gernot Frisch" <Me@Privacy.net> wrote in message
news:3c*************@individual.net...
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".


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
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.