public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alberto Garcia Raboso <Alberto.Garcia.Raboso@cern.ch>
To: "Moore, Mathew L" <MooreML@BATTELLE.ORG>
Cc: "'Alberto Garcia Raboso'" <Alberto.Garcia.Raboso@cern.ch>,
	gcc-help@gcc.gnu.org
Subject: RE: STL iterators in gcc 3.2
Date: Fri, 25 Oct 2002 08:57:00 -0000	[thread overview]
Message-ID: <Pine.LNX.3.95a.1021025175318.23947D-100000@lxplus024.cern.ch> (raw)
In-Reply-To: <2F05A390F72A0A409390E016D23E45E8042DBECB@ns-bco-mse4.im.battelle.org>


> 
> From what I've noticed, the old 2.95 implemented std::vector iterators as
> just plain pointers (|std::vector<double>| used |double*|'s for iteration).
> It looks like now the library is using class abstractions for its iterators.
> This has many benefits, but it also means that some code, e.g.,
> 
> 	void foo(double*);
> 	std::vector<double> myvect;
> 	foo(myvect.begin());
> 
> will no longer work, since |myvect.begin()| does not necessarily produce a
> double*.  
> 
> I have found in order to make your code independent of the iterator object,
> you have to either use templates,
> 
> 	template <typename OutputIterator>
> 	void foo(OutputIterator);
> 
> or you must specifically use the iterator type defined by your container,
> 
> 	void foo(std::vector<double>::iterator);
> 
> I don't know if there is an easier conversion than either of these, but I
> would be interested in hearing any other ideas.

Of course, this explains vey well he problem. But I cannot use new
definitions of the methods using template arguments instead of pointers,
as they come from a library... So I think I'll have to use a previous
version of gcc, at least until I have time to change my code to adhere to
the standards ;-)

Anyway, thank you very much.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Alberto Garcia Raboso
CERN / EP
CH-1211 Geneva 23, Switzerland
Office 40-2B-19 (+41 22 76 71626)
E-Mail: Alberto.Garcia.Raboso@cern.ch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Well, farewell, my hobbits! You should come safe to your own
homes now, and I shall not be kept awake for fear of your
peril. We will send word when we may, and some of us may yet
meet at times; but I fear that we shall not all be gathered
together ever again.

                      The return of the King. J.R.R. Tolkien
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  reply	other threads:[~2002-10-25 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25  8:43 Moore, Mathew L
2002-10-25  8:57 ` Alberto Garcia Raboso [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-25  8:24 Alberto Garcia Raboso
2002-10-25  8:42 ` John Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.3.95a.1021025175318.23947D-100000@lxplus024.cern.ch \
    --to=alberto.garcia.raboso@cern.ch \
    --cc=MooreML@BATTELLE.ORG \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).