Topic: About set...
Author: jpotter@falcon.lhup.edu (John Potter)
Date: Mon, 30 Apr 2001 02:39:26 GMT Raw View
On Sun, 29 Apr 2001 13:20:42 GMT, "Igor Krasnopeev"
<captaincomatoz@mail.ru> wrote:
> Total order is not maintained!
>
> Any suggestions?
See lwg issue 103.
John
---
[ 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 ]
Author: "Igor Krasnopeev" <captaincomatoz@mail.ru>
Date: Sun, 29 Apr 2001 13:20:42 GMT Raw View
>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 ]