Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

An alternative to reverse-iterators

12 views
Skip to first unread message

Bonita Montero

unread,
May 17, 2021, 9:30:42 AM5/17/21
to
I don't like reverse-iterators because when converting to a
forward-iterator with .base() you've to adjust it with prev()
so that it points to the same object as the reverse-iterator.
So I found a nice alternative:

for( itQueue = m_taskQueue.end(); ; itQueue = itQPrev )
if( itQueue == m_taskQueue.begin() )
return;
else if( (itQPrev = prev( itQueue))->id == queueId )
break;

I need itQueue fter the loop and with what I did I don't
need any additional conversions.
0 new messages