MSVC9 does not support upper_bound with an asymmetric comparator.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 21 Sep 2010 18:24:30 +0000 (18:24 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 21 Sep 2010 18:24:30 +0000 (18:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114455 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveInterval.cpp

index 6a6ecf78f68e26e0cbe9d6823211b3248da8e6e6..199e5000b60e7f941a380f61628a748f5f49c9e7 100644 (file)
 #include <algorithm>
 using namespace llvm;
 
-// compEnd - Compare LiveRange end to Pos.
-// This argument ordering works for upper_bound.
-static inline bool compEnd(SlotIndex Pos, const LiveRange &LR) {
-  return Pos < LR.end;
-}
+// CompEnd - Compare LiveRange end to Pos.
+struct CompEnd {
+  bool operator()(SlotIndex Pos, const LiveRange &LR) const {
+    return Pos < LR.end;
+  }
+  bool operator()(const LiveRange &LR, SlotIndex Pos) const {
+    return LR.end < Pos;
+  }
+};
 
 LiveInterval::iterator LiveInterval::find(SlotIndex Pos) {
-  return std::upper_bound(begin(), end(), Pos, compEnd);
+  return std::upper_bound(begin(), end(), Pos, CompEnd());
 }
 
 /// killedInRange - Return true if the interval has kills in [Start,End).