From 512998986553029576 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,66d20309909372f6 X-Google-Attributes: gidf78e5,public From: James Kuyper Subject: Re: STL and set_union algorithm question? (newbie to STL!) Date: 1998/04/06 Message-ID: <35290568.2781@wizard.net>#1/1 X-Deja-AN: 341420710 Approved: Fergus Henderson Content-Transfer-Encoding: 7bit References: <6g2te9$a7n$1@ukwsv3.ggr.co.uk> X-Original-Date: Mon, 06 Apr 1998 12:40:08 -0400 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANSkW2OEDnX0m9pzZAQFbzAGAjvPaQm+MHytISyTgAd5XFoR08h/imH85 6L3Lddeq8NSZOhsZnKhWsyIIdS6ZfVL/ =geOd Newsgroups: comp.std.c++ NJ Biggs wrote: > > I am new to STL and am after a little help. > > Can anyone please post a short example of using the set_union algorithm on > two set objects that places the result in a third set. > > Sort of... > set s1; > set s2; > set result; > > set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), result.end()); > > My compiler refuses to compile this due to the result.end() iterator being > returned as a const_iterator. set::end() on a non-const set object is supposed to return set::iterator, not set::const_iterator. You have a defective implementation of STL. --- [ 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 ]