This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Interpretation of DR 198 resolution


----- Original Message ----- 
From: "Paolo Carlini" <pcarlini@unitus.it>
To: "Nathan Myers" <ncm-nospam@cantrip.org>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>
Sent: Tuesday, November 11, 2003 7:30 PM
Subject: Re: [RFC] Interpretation of DR 198 resolution


> Thanks Nathan for your feedback.
> 
> Unfortunately, I'm not sure to fully understand your explanation,
> or, better, I'm not sure to understand why the resolution wants to
> change "Effects:" from:
> 
>    Iterator tmp = current;
>    return *--tmp;
> 
> to
> 
>    this->tmp = current;
>    --this->tmp;
>    return *this->tmp;
> 

It is dependent on the other part of DR#198:

"Destruction of an iterator may invalidate pointers and references previously obtained from that iterator"

If that sentence is accepted, the reference returned from operator*() might be invalid after tmp is destroyed. If...

One solution is of course to keep tmp around, so that it is not destroyed until later.


Bo Persson



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]