Subject: [boost] [intrusive.set] Accessing the last (largest) element.
From: Andy Venikov (avenikov_at_[hidden])
Date: 2010-04-15 10:34:55


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.