Added post_t::compare_by_date_and_sequence comparator
This commit is contained in:
parent
6870c54644
commit
313c88a656
1 changed files with 14 additions and 0 deletions
14
src/post.h
14
src/post.h
|
|
@ -199,6 +199,20 @@ public:
|
||||||
|
|
||||||
friend class xact_t;
|
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)
|
#if defined(HAVE_BOOST_SERIALIZATION)
|
||||||
private:
|
private:
|
||||||
/** Serialization. */
|
/** Serialization. */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue