summaryrefslogtreecommitdiff
path: root/utils/best.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/best.h')
-rwxr-xr-xutils/best.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/best.h b/utils/best.h
index 8ff896bb..689e7600 100755
--- a/utils/best.h
+++ b/utils/best.h
@@ -8,6 +8,21 @@ typedef MaxPlus<double> best_t;
inline bool operator <(best_t const& a,best_t const& b) {
return a.v_>b.v_; // intentionally reversed, so default min-heap, sort, etc. put best first.
}
+struct BetterP {
+ inline bool operator ()(best_t const& a,best_t const& b) const {
+ return a.v_>b.v_; // intentionally reversed, so default min-heap, sort, etc. put best first.
+ }
+};
+inline void maybe_improve(best_t &a,best_t const& b) {
+ if (a.v_>b.v_)
+ a.v_=b.v_;
+}
+
+template <class O>
+inline void maybe_improve(best_t &a,O const& b) {
+ if (a.v_>b.v_)
+ a.v_=b.v_;
+}
#endif