From -7177482770010086287
X-Google-Thread: f78e5,1130da7a3640a78c
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.vmunix.org!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: brangdon@cix.co.uk (Dave Harris)
Newsgroups: comp.std.c++
Subject: Re: Deprecate the use of plain pointers as standard container iterators
Date: Tue,  9 May 2006 20:24:07 GMT
Lines: 43
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <memo.20060509203036.700A@brangdon.cix.compulink.co.uk>
References: <1147122934.938877.153140@g10g2000cwb.googlegroups.com>
NNTP-Posting-Host: news.news.demon.net
X-Trace: news.demon.co.uk 1147206254 22992 158.152.254.254 (9 May 2006 20:24:14 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 9 May 2006 20:24:14 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Orig-X-Trace: individual.net cYRx5ItQe5v+kbQUNYfPygu3FlFVaLmS7FunFV0dX0BKmInNE=
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Reply-To: brangdon@cix.co.uk
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id k49KO7RW020461;
	Wed, 10 May 2006 06:24:07 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news2.google.com comp.std.c++:1858

kuyper@wizard.net () wrote (abridged):
> Yes, but in order to show that there really is a problem that calls for
> a change to the standard, it's helpful to provide an example where the
> problem that's being demonstrated is not easily fixed by methods that
> don't involve changing the standard.

For me the problem is with code like:

    #include <vector>
       
    void func( std::vector<int>::iterator ) {}
    void func( int * ) {}

On some platforms this defines two functions, and on others it is an error 
because it defines the same function twice.

The easiest attempt at a workaround is to omit the iterator overload, and 
change the point of call:

     std::vector<int>::iterator i;
     int *p;
     // ... initialise i and p...

     func( p ); // Works always.
     func( &*i ); // Works if i is not v.end().
     func( &*p ); // Works if p is not NULL.
     func( i ); // Works on some platforms.

The "&*i" adds clutter, and puts a burden onto users of func() to remember 
and use it, and if they forget the compiler may not warn them (depending 
on the platform), and it doesn't work if i is singular. It's not very 
good, really.

Nicola Musatti's suggestion would be a better solution.

-- Dave Harris, Nottingham, UK.

---
[ 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.comeaucomputing.com/csc/faq.html                      ]



