From 414206144180007198
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,66d20309909372f6
X-Google-Attributes: gidf78e5,public
From: Oleg Zabluda <zabluda@math.psu.edu>
Subject: Re: STL and set_union algorithm question? (newbie to STL!)
Date: 1998/04/16
Message-ID: <6h13id$el1@marianna.psu.edu>#1/1
X-Deja-AN: 344526420
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <6g2te9$a7n$1@ukwsv3.ggr.co.uk> <35290568.2781@wizard.net> <352A9B77.2781E494@pratique.fr> <6gelt5$mpp@marianna.psu.edu> <fxtsono2jp4.fsf@isolde.mti.sgi.com> <35326714.15FB@wizard.net>
X-Original-Date: 14 Apr 1998 21:46:53 -0400
X-Server-Date: 15 Apr 1998 04:59:38 GMT
Organization: Penn State University, Center for Academic Computing
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANTVqDOEDnX0m9pzZAQGanwF+Lp0tqHaFwCarvL6+P2iWfkJY1rrlDlzY 5IwlLCDubSMz0JPPBlpgv7OSuC2ggCOI =xh5I
Reply-To: zabluda@math.psu.edu (Oleg Zabluda)
Newsgroups: comp.std.c++


James Kuyper <kuyper@wizard.net> wrote:
: Matt Austern wrote:
: ...
: > I can understand wanting set<>::iterator and set<>::const_iterator to
: > be distinct types, just for the sake of stricter type-checking.  (The
: > standard neither requires nor forbids them to be distinct types.)
: > 
: > I can't, though, understand wanting set<>::iterator to be a modifiable
: > iterator.  The whole point of set<> (and all of the other associative

: If a non-const iterator were implementable for set<>, then (*i)=b should
: be the equivalent of erase(i) followed by an insert(b). This would be of
: neglible importance in typical uses of sets, but would allow modifying
: algorithms to be applied to sets without being aware of the special
: characteristics of sets.

You can easily provide such an iterator yourself. Call it
replace_iterator<Iterator>. And the corresponding function
replacer(Iterator).

Just a thought.

Oleg.
-- 
Life is a sexually transmitted, 100% lethal disease.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]



