On Wed, Aug 25, 2010 at 2:44 AM, Jaroslav Hajek <high...@gmail.com> wrote: > Hi all, > > I've been experimenting with sorting recently and I have noticed a > possibility to slightly optimize the sorting of std::pair values using > the default < operator. This is, I believe, a common usage case to > retrieve sorting indices (better locality of reference than sorting > via pointers). At least I usually do it that way :) > > The idea is simple: we know how the < operator for std::pairs looks > like; basically it's > x.first < y.first || (! (y.first < x.first) && x.second < y.second) >
std::pair can be specialized (along with user defined comparators.) How are you handling that?