From 313c88a6566dd3aee78069125925c867ae24e871 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 4 Feb 2010 19:48:11 -0500 Subject: Added post_t::compare_by_date_and_sequence comparator --- src/post.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/post.h b/src/post.h index cea1aca1..3a8c5541 100644 --- a/src/post.h +++ b/src/post.h @@ -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. */ -- cgit v1.2.3