From -7286303951921213342
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/17
Message-ID: <37B98D53.3B7@wanadoo.fr>#1/1
X-Deja-AN: 513848997
Content-Transfer-Encoding: 7bit
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
References: <7p4nj8$n3u@enews4.newsguy.com> <37B98C2E.E3A1EA71@acm.org>
X-Original-Date: Tue, 17 Aug 1999 18:26:59 +0200
Content-Type: text/plain; charset=us-ascii
Organization: Ecole normale superieure
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUAN7mN1awEuYhIxRhxAQHQuAIAkIVvU35ZnHTtkXoPVfPbanSdcpmfjQwN TxfMyXNIjpagPu1rq62Z64Zy3V+qtQ1uJE5rbnR8IuIaYjTfmEPQvw== =ZKrl
Mime-Version: 1.0
Newsgroups: comp.std.c++

Pete Becker wrote:

> Darin Adler wrote:

> >     bool check_equal(std::deque<int>::iterator i,
> >         std::deque<int>::const_iterator ci)
> >     {
> >         return i == ci;
> >     }
> >
> 
> Agreed. But the begin and end iterators that you get from a container
> are of the same type, and they work just fine for the standard STL
> idioms. Why do you need to do this? What coding practices does it
> support?

Would you consider the following unatural or silly ?

for (const_iterator it = begin(); it!=end(); ++it)
    foo (*it);

Being able to write a for loop is a standard C++ idiom.

-- 

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              ]



