[intrusive.set] Accessing the last (largest) element.

Since there is no "back" method for intrusive set, what's the best way to access the last (greatest) element? Is this OK:? IntrusiveSet set1; IntrusiveSet::iterator itEnd = set1.end(); //Make sure that set isn't empty. Value v = *--itEnd; ++itEnd; //will itEnd point to set1.end() after this? In general, is there anything sinister about this construct? (provided that the set isn't empty) Thanks, Andy.

Ion Gaztañaga wrote:
On 15/04/2010 16:34, Andy Venikov wrote:
Since there is no "back" method for intrusive set, what's the best way to access the last (greatest) element?
Is this OK:?
Yes, what about rbegin()?
Yup, rbegin will work. But I already have a range (begin<-->end), and just need to access the last element in the range.
Best,
Ion _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks, Andy.
participants (2)
-
Andy Venikov
-
Ion Gaztañaga