diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-08-10 20:48:29 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-08-10 20:48:29 +0000 |
commit | eb2692571fab1cc9996c0b972aee5e1c48ae0989 (patch) | |
tree | 862739b146f0c019b81347516a3b305b88d74ec8 /libcxx/include/cstddef | |
parent | 3b870f045f571507c541ae386473c665ee110f3f (diff) | |
download | bcm5719-llvm-eb2692571fab1cc9996c0b972aee5e1c48ae0989.tar.gz bcm5719-llvm-eb2692571fab1cc9996c0b972aee5e1c48ae0989.zip |
patch by Jesse Towner, and bug fix by Sebastian Redl
llvm-svn: 110724
Diffstat (limited to 'libcxx/include/cstddef')
-rw-r--r-- | libcxx/include/cstddef | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef index f6b34ad5c97..8cba5f8a2ec 100644 --- a/libcxx/include/cstddef +++ b/libcxx/include/cstddef @@ -78,6 +78,42 @@ struct nullptr_t friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;} + + template <typename _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, _Tp* __p) {return 0 == __p;} + + template <typename _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator==(_Tp* __p, nullptr_t) {return __p == 0;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, _Tp* __p) {return 0 != __p;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator!=(_Tp* __p, nullptr_t) {return __p != 0;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, _Tp* __p) {return 0 < __p;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator<(_Tp* __p, nullptr_t) {return __p < 0;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, _Tp* __p) {return 0 <= __p;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator<=(_Tp* __p, nullptr_t) {return __p <= 0;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, _Tp* __p) {return 0 > __p;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator>(_Tp* __p, nullptr_t) {return __p > 0;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, _Tp* __p) {return 0 >= __p;} + + template <class _Tp> + friend _LIBCPP_ALWAYS_INLINE bool operator>=(_Tp* __p, nullptr_t) {return __p >= 0;} }; inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);} |