Add operator== and operator!= to compare with nullptr.

llvm-svn: 210100
This commit is contained in:
Rafael Espindola 2014-06-03 13:26:18 +00:00
parent b7fd1bd223
commit 6d5ec8fee3
1 changed files with 20 additions and 0 deletions

View File

@ -241,6 +241,26 @@ public:
return A != B.getPtr();
}
template <class T>
bool operator==(std::nullptr_t A, const IntrusiveRefCntPtr<T> &B) {
return !B;
}
template <class T>
bool operator==(const IntrusiveRefCntPtr<T> &A, std::nullptr_t B) {
return !A;
}
template <class T>
bool operator!=(std::nullptr_t A, const IntrusiveRefCntPtr<T> &B) {
return !(A == B);
}
template <class T>
bool operator!=(const IntrusiveRefCntPtr<T> &A, std::nullptr_t B) {
return !(A == B);
}
//===----------------------------------------------------------------------===//
// LLVM-style downcasting support for IntrusiveRefCntPtr objects
//===----------------------------------------------------------------------===//