From 7362217755705475086
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,beafde7e6b3ac384,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-04-29 06:21:02 PST
Path: newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: "Igor Krasnopeev" <captaincomatoz@mail.ru>
Newsgroups: comp.std.c++
Subject: About set...
Date: Sun, 29 Apr 2001 13:20:42 GMT
Organization: EDN Sovintel
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <9cerl4$11ud$1@josh.sovintel.ru>
X-Trace: mail2news.demon.co.uk 988550446 mail2news:7667 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
NNTP-Posting-Date: 28 Apr 2001 16:37:56 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Lines: 54
Xref: newsfeed.google.com comp.std.c++:4263

>From Standard C++ Library: Class Reference we have:

set<Key, Compare, Allocator> is an associative container that supports
unique keys and allows for fast retrieval of the keys. A set contains, at
most, one of any key value. The keys are sorted using Compare.

Since a set maintains a total order on its elements, you cannot alter the
key values directly. Instead, you must insert new elements with an
insert_iterator.

But, also:

Iterators

iterator begin();

Returns an iterator that points to the first element in self.

So, it is possible to wtire next code:

std::set<int> S;
S.insert(1);
S.insert(2);

std::copy(S.begin(), S.end(), ostream_iterator<int,char>(std::cout," "));
/ / output is 1 2

std::set<int> SI = S.begin();
*SI = 3;

std::copy(S.begin(), S.end(), ostream_iterator<int,char>(std::cout," "));
/ / now output is 3 2

Total order is not maintained!

Any suggestions?

Igor Krasnopeev


begin 666 Krasnopeev Igor.vcf
M0D5'24XZ5D-!4D0-"E9%4E-)3TXZ,BXQ#0I..DMR87-N;W!E978[26=O<@T*
M1DXZ2W)A<VYO<&5E=B!)9V]R#0I.24-+3D%-13I$87)K(%)A=F5N#0I%34%)
M3#M04D5&.TE.5$523D54.F-A<'1A:6YC;VUA=&]Z0&UA:6PN<G4-"E)%5CHR
<,# Q,#0R.%0Q-C,Y,3-:#0I%3D0Z5D-!4D0-"@``
`
end

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



