Make some minor improvements to APInt:
[oota-llvm.git] / include / llvm / ADT / ilist
index 877e1445f4875cd9dd7c44b3dc873a82b0fc1655..1d01b63fe73647e4ca28172658bdcba6f1ab0520 100644 (file)
@@ -169,6 +169,26 @@ void operator+(int, ilist_iterator<T>);
 template<typename T>
 void operator+(ilist_iterator<T>,int);
 
+// operator!=/operator== - Allow mixed comparisons without dereferencing
+// the iterator, which could very likely be pointing to end().
+template<typename T>
+bool operator!=(const T* LHS, const ilist_iterator<const T> &RHS) {
+  return LHS != RHS.getNodePtrUnchecked();
+}
+template<typename T>
+bool operator==(const T* LHS, const ilist_iterator<const T> &RHS) {
+  return LHS == RHS.getNodePtrUnchecked();
+}
+template<typename T>
+bool operator!=(T* LHS, const ilist_iterator<T> &RHS) {
+  return LHS != RHS.getNodePtrUnchecked();
+}
+template<typename T>
+bool operator==(T* LHS, const ilist_iterator<T> &RHS) {
+  return LHS == RHS.getNodePtrUnchecked();
+}
+
+
 // Allow ilist_iterators to convert into pointers to a node automatically when
 // used by the dyn_cast, cast, isa mechanisms...