Added post_t::compare_by_date_and_sequence comparator

This commit is contained in:
John Wiegley 2010-02-04 19:48:11 -05:00
parent 6870c54644
commit 313c88a656

View file

@ -199,6 +199,20 @@ public:
friend class xact_t;
struct compare_by_date_and_sequence
{
bool operator()(const post_t * left, const post_t * right) const {
gregorian::date_duration duration =
left->actual_date() - right->actual_date();
if (duration.days() == 0) {
return ((left->pos ? left->pos->sequence : 0) <
(right->pos ? right->pos->sequence : 0));
} else {
return duration.days() < 0;
}
}
};
#if defined(HAVE_BOOST_SERIALIZATION)
private:
/** Serialization. */