diff options
Diffstat (limited to 'libcxx/include/typeindex')
| -rw-r--r-- | libcxx/include/typeindex | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex index 5fb7b30ecfee..e3132c8cb856 100644 --- a/libcxx/include/typeindex +++ b/libcxx/include/typeindex @@ -23,11 +23,12 @@ public: type_index(const type_info& rhs) noexcept; bool operator==(const type_index& rhs) const noexcept; - bool operator!=(const type_index& rhs) const noexcept; + bool operator!=(const type_index& rhs) const noexcept; // removed in C++20 bool operator< (const type_index& rhs) const noexcept; bool operator<=(const type_index& rhs) const noexcept; bool operator> (const type_index& rhs) const noexcept; bool operator>=(const type_index& rhs) const noexcept; + strong_ordering operator<=>(const type_index& rhs) const noexcept; // C++20 size_t hash_code() const noexcept; const char* name() const noexcept; @@ -50,12 +51,6 @@ struct hash<type_index> #include <typeinfo> #include <version> -#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES -# include <iosfwd> -# include <new> -# include <utility> -#endif - // standard-mandated includes #include <compare> @@ -76,8 +71,10 @@ public: bool operator==(const type_index& __y) const _NOEXCEPT {return *__t_ == *__y.__t_;} _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_STD_VER <= 17 bool operator!=(const type_index& __y) const _NOEXCEPT {return *__t_ != *__y.__t_;} +#endif _LIBCPP_INLINE_VISIBILITY bool operator< (const type_index& __y) const _NOEXCEPT {return __t_->before(*__y.__t_);} @@ -90,6 +87,16 @@ public: _LIBCPP_INLINE_VISIBILITY bool operator>=(const type_index& __y) const _NOEXCEPT {return !__t_->before(*__y.__t_);} +#if _LIBCPP_STD_VER > 17 + _LIBCPP_HIDE_FROM_ABI + strong_ordering operator<=>(const type_index& __y) const noexcept { + if (*__t_ == *__y.__t_) + return strong_ordering::equal; + if (__t_->before(*__y.__t_)) + return strong_ordering::less; + return strong_ordering::greater; + } +#endif _LIBCPP_INLINE_VISIBILITY size_t hash_code() const _NOEXCEPT {return __t_->hash_code();} @@ -110,4 +117,10 @@ struct _LIBCPP_TEMPLATE_VIS hash<type_index> _LIBCPP_END_NAMESPACE_STD +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <iosfwd> +# include <new> +# include <utility> +#endif + #endif // _LIBCPP_TYPEINDEX |
