|
|
@@ -7,103 +7,109 @@
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
-#define POINTER_TEMPLATE_COMPARE( ptr_t ) \
|
|
|
- POINTER_TEMPLATE_COMPARE_FULL( ptr_t, (typename T), (T), (typename U), (U) )
|
|
|
+#define POINTER_TEMPLATE_COMPARE(ptr_t) \
|
|
|
+ POINTER_TEMPLATE_COMPARE_FULL(ptr_t, (typename T), (T), (typename U), (U))
|
|
|
|
|
|
-#define EXPAND( ... ) __VA_ARGS__
|
|
|
+#define EXPAND(...) __VA_ARGS__
|
|
|
|
|
|
-#define POINTER_TEMPLATE_COMPARE_FULL( ptr_t, T_tname, T, U_tname, U ) \
|
|
|
-template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
-bool operator==(ptr_t< EXPAND T > const&lhs, ptr_t< EXPAND U > const&rhs) noexcept { \
|
|
|
- return lhs.get() == rhs.get(); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
-bool operator!=(ptr_t< EXPAND T > const&lhs, ptr_t< EXPAND U > const&rhs) noexcept { \
|
|
|
- return !(lhs == rhs); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
-bool operator< (ptr_t< EXPAND T > const&lhs, ptr_t< EXPAND U > const&rhs) noexcept { \
|
|
|
- typedef typename std::common_type< \
|
|
|
- typename ptr_t< EXPAND T >::pointer, \
|
|
|
- typename ptr_t< EXPAND U >::pointer>::type V; \
|
|
|
- return std::less<V>(lhs.get(), rhs.get()); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
-bool operator> (ptr_t< EXPAND T > const&lhs, ptr_t< EXPAND U > const&rhs) noexcept { \
|
|
|
- return rhs < lhs; \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
-bool operator<=(ptr_t< EXPAND T > const&lhs, ptr_t< EXPAND U > const&rhs) noexcept { \
|
|
|
- return !(rhs < lhs); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
-bool operator>=(ptr_t< EXPAND T > const&lhs, ptr_t< EXPAND U > const&rhs) noexcept { \
|
|
|
- return !(lhs < rhs); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator==(ptr_t< EXPAND T > const&lhs, std::nullptr_t) noexcept { \
|
|
|
- return !lhs; \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator==(std::nullptr_t, ptr_t< EXPAND T > const&rhs) noexcept { \
|
|
|
- return !rhs; \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator!=(ptr_t< EXPAND T > const&lhs, std::nullptr_t) noexcept { \
|
|
|
- return static_cast<bool>(lhs); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator!=(std::nullptr_t, ptr_t< EXPAND T > const&rhs) noexcept { \
|
|
|
- return static_cast<bool>(rhs); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator< (ptr_t< EXPAND T > const&lhs, std::nullptr_t) noexcept { \
|
|
|
- typedef typename ptr_t< EXPAND T >::pointer V; \
|
|
|
- return std::less<V>(lhs.get(), nullptr); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator< (std::nullptr_t, ptr_t< EXPAND T > const&rhs) noexcept { \
|
|
|
- typedef typename ptr_t< EXPAND T >::pointer V; \
|
|
|
- return std::less<V>(nullptr, rhs.get()); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator> (ptr_t< EXPAND T > const&lhs, std::nullptr_t) noexcept { \
|
|
|
- return nullptr < lhs; \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator> (std::nullptr_t, ptr_t< EXPAND T > const&rhs) noexcept { \
|
|
|
- return rhs < nullptr; \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator<=(ptr_t< EXPAND T > const&lhs, std::nullptr_t) noexcept { \
|
|
|
- return !(nullptr < lhs); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator<=(std::nullptr_t, ptr_t< EXPAND T > const&rhs) noexcept { \
|
|
|
- return !(rhs < nullptr); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator>=(ptr_t< EXPAND T > const&lhs, std::nullptr_t) noexcept { \
|
|
|
- return !(lhs < nullptr); \
|
|
|
-} \
|
|
|
-\
|
|
|
-template <EXPAND T_tname> \
|
|
|
-bool operator>=(std::nullptr_t, ptr_t< EXPAND T > const&rhs) noexcept { \
|
|
|
- return !(nullptr < rhs); \
|
|
|
-}
|
|
|
+#define POINTER_TEMPLATE_COMPARE_FULL(ptr_t, T_tname, T, U_tname, U) \
|
|
|
+ template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
+ bool operator==(ptr_t<EXPAND T> const & lhs, \
|
|
|
+ ptr_t<EXPAND U> const & rhs) noexcept { \
|
|
|
+ return lhs.get() == rhs.get(); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
+ bool operator!=(ptr_t<EXPAND T> const & lhs, \
|
|
|
+ ptr_t<EXPAND U> const & rhs) noexcept { \
|
|
|
+ return !(lhs == rhs); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
+ bool operator<(ptr_t<EXPAND T> const & lhs, \
|
|
|
+ ptr_t<EXPAND U> const & rhs) noexcept { \
|
|
|
+ typedef \
|
|
|
+ typename std::common_type<typename ptr_t<EXPAND T>::pointer, \
|
|
|
+ typename ptr_t<EXPAND U>::pointer>::type V; \
|
|
|
+ return std::less<V>(lhs.get(), rhs.get()); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
+ bool operator>(ptr_t<EXPAND T> const & lhs, \
|
|
|
+ ptr_t<EXPAND U> const & rhs) noexcept { \
|
|
|
+ return rhs < lhs; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
+ bool operator<=(ptr_t<EXPAND T> const & lhs, \
|
|
|
+ ptr_t<EXPAND U> const & rhs) noexcept { \
|
|
|
+ return !(rhs < lhs); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname, EXPAND U_tname> \
|
|
|
+ bool operator>=(ptr_t<EXPAND T> const & lhs, \
|
|
|
+ ptr_t<EXPAND U> const & rhs) noexcept { \
|
|
|
+ return !(lhs < rhs); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator==(ptr_t<EXPAND T> const & lhs, std::nullptr_t) noexcept { \
|
|
|
+ return !lhs; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator==(std::nullptr_t, ptr_t<EXPAND T> const & rhs) noexcept { \
|
|
|
+ return !rhs; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator!=(ptr_t<EXPAND T> const & lhs, std::nullptr_t) noexcept { \
|
|
|
+ return static_cast<bool>(lhs); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator!=(std::nullptr_t, ptr_t<EXPAND T> const & rhs) noexcept { \
|
|
|
+ return static_cast<bool>(rhs); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator<(ptr_t<EXPAND T> const & lhs, std::nullptr_t) noexcept { \
|
|
|
+ typedef typename ptr_t<EXPAND T>::pointer V; \
|
|
|
+ return std::less<V>(lhs.get(), nullptr); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator<(std::nullptr_t, ptr_t<EXPAND T> const & rhs) noexcept { \
|
|
|
+ typedef typename ptr_t<EXPAND T>::pointer V; \
|
|
|
+ return std::less<V>(nullptr, rhs.get()); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator>(ptr_t<EXPAND T> const & lhs, std::nullptr_t) noexcept { \
|
|
|
+ return nullptr < lhs; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator>(std::nullptr_t, ptr_t<EXPAND T> const & rhs) noexcept { \
|
|
|
+ return rhs < nullptr; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator<=(ptr_t<EXPAND T> const & lhs, std::nullptr_t) noexcept { \
|
|
|
+ return !(nullptr < lhs); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator<=(std::nullptr_t, ptr_t<EXPAND T> const & rhs) noexcept { \
|
|
|
+ return !(rhs < nullptr); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator>=(ptr_t<EXPAND T> const & lhs, std::nullptr_t) noexcept { \
|
|
|
+ return !(lhs < nullptr); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ template <EXPAND T_tname> \
|
|
|
+ bool operator>=(std::nullptr_t, ptr_t<EXPAND T> const & rhs) noexcept { \
|
|
|
+ return !(nullptr < rhs); \
|
|
|
+ }
|