diff options
author | John Wiegley <johnw@newartisans.com> | 2010-02-04 19:48:11 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-02-05 00:00:40 -0500 |
commit | 313c88a6566dd3aee78069125925c867ae24e871 (patch) | |
tree | 798d040811e9cfc0f51ad822c4369f5252bd9fc0 /src/post.h | |
parent | 6870c54644ba41fe360d43d27885ded46beac7c5 (diff) | |
download | fork-ledger-313c88a6566dd3aee78069125925c867ae24e871.tar.gz fork-ledger-313c88a6566dd3aee78069125925c867ae24e871.tar.bz2 fork-ledger-313c88a6566dd3aee78069125925c867ae24e871.zip |
Added post_t::compare_by_date_and_sequence comparator
Diffstat (limited to 'src/post.h')
-rw-r--r-- | src/post.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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. */ |