473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

non-sorting std::set ?

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
4 1636
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

"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

"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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: les_ander | last post by:
Hi, I have many set objects some of which can contain same group of object while others can be subset of the other. Given a list of sets, I need to get a list of unique sets such that non of the...
12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
5
by: Jacob Page | last post by:
I have released interval-0.2.1 at http://members.cox.net/apoco/interval/. IntervalSet and FrozenIntervalSet objects are now (as far as I can tell) functionality equivalent to set and frozenset...
19
by: MKoool | last post by:
I have a file with binary and ascii characters in it. I massage the data and convert it to a more readable format, however it still comes up with some binary characters mixed in. I'd like to...
7
by: Michi Henning | last post by:
Hi, I'm using a non-blocking connect to connect to a server. Works fine -- the server gets and accepts the connection. However, once the connection is established, I cannot retrieve either the...
11
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit...
90
by: Christoph Zwerschke | last post by:
Ok, the answer is easy: For historical reasons - built-in sets exist only since Python 2.4. Anyway, I was thinking about whether it would be possible and desirable to change the old behavior in...
4
by: LurfysMa | last post by:
I could use some help with a table design problem. I have an electronic flashcard program. Actually, several of them. They each rely on a utility program to keep track of the usage statistics....
5
by: Timothy Madden | last post by:
Hello Is there a function that will allow me to output text written in utf-8 (from db for example) if my document has Content-Type: text/html; charset=ISO-8859-1 I mean htmlspecialchars()...
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.