logo       

Re: Support for Indexing and Iteration Safety: msg#00347

python.c++

Subject: Re: Support for Indexing and Iteration Safety

"David Abrahams" <dave@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:u4r3dzibn.fsf@xxxxxxxxxxxxxxxxxxxxxxx
> Mike, please take this discussion to the C++-sig...
It is there. I did courtesy CC: when posted to -sig because original mail
felt into my e-mail inbox. ;)

> > static void del(T& x, int n) {
> > if( n<0 ) n+=x.size();
> > if( n<x.size() && n>=0 ) x.erase(&x[n]);
> > else IndexError(); } ^^^^^
> > }; ^^^^^
> Doesn't work (not an iterator).
Sorry. I'm spoiled by MSVC. Hope x.erase( Container<T>::iterator(&x[n]) )
will do?
(with proper Container type)

> I have something a little less simplistic in mind. Why shouldn't
> everyone benefit? ;-)

It will be very nice thing to have.

> > My 0.02. Hope I made my point clear.
>
> Not really. The clearest message I can discern is "there's really not
> much of a problem". Is that really what you're saying?

Not really. In my case I made it so with very simplistic approach AND
reducing my usage pattern.
I recall my surprise it isn't in place and sure agree with your answer "loud
NO" to any unpredictable behavior.
So I understand why it's better not to have then have unreliable.
I tried to argue in support of having something shall be reliable out of the
box.
For that goal it may be not the fastest and not the simplest.

Mike


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise