From -8429376562560395169
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7eaa8faac8da5016
X-Google-Attributes: gidf78e5,public
From: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Subject: Re: Defect Report: member == in container iterators considered harmful
Date: 1999/08/18
Message-ID: <37BAB901.4965@wanadoo.fr>#1/1
X-Deja-AN: 514257048
X-NNTP-Posting-Host: fuste.ens.fr
Content-Transfer-Encoding: 7bit
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <7p4nj8$n3u@enews4.newsguy.com> <37B98C2E.E3A1EA71@acm.org> <37B98D53.3B7@wanadoo.fr> <37B9A195.B7090C3C@acm.org>
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
Organization: Ecole normale superieure
Mime-Version: 1.0
Newsgroups: comp.std.c++
Originator: clamage@taumet


Pete Becker wrote:

> Valentin Bonnard wrote:

> > Would you consider the following unatural or silly ?
> >
> > for (const_iterator it = begin(); it!=end(); ++it)
> >     foo (*it);
> >
> 
> Absolutely. <g> 

I was sure that you would say that.

> The standard STL idiom is to put the loop in a template
> function. 

I wouldn't expect every one-use algorithm to be encapsulated in 
a function. It's very tedious.

To use the algorithm you need to know by heart the combinators, 
which are ugly and verbose.

> for (Container::iterator it = cont.begin(); it != cont.end(); ++it)
>         foo(*it);

??? (re read my code example)

-- 

Valentin Bonnard


[ 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              ]




