[libc++][NFC] Move monostate to its own header.
The format library uses `std::monostate`, but not a `std::variant`.
Moving `std::monostate` to its own header allows the format library to
reduce the amount of included code.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D105582
NOKEYCHECK=True
GitOrigin-RevId: 321c2ea91cb1aed5dfbbdbb868d525ff64972398
diff --git a/include/variant b/include/variant
index 2145700..08b6461 100644
--- a/include/variant
+++ b/include/variant
@@ -202,6 +202,7 @@
#include <__availability>
#include <__config>
#include <__utility/forward.h>
+#include <__variant/monostate.h>
#include <__tuple>
#include <array>
#include <compare>
@@ -1703,26 +1704,6 @@
}
#endif
-struct _LIBCPP_TEMPLATE_VIS monostate {};
-
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr bool operator<(monostate, monostate) noexcept { return false; }
-
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr bool operator>(monostate, monostate) noexcept { return false; }
-
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr bool operator<=(monostate, monostate) noexcept { return true; }
-
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr bool operator>=(monostate, monostate) noexcept { return true; }
-
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr bool operator==(monostate, monostate) noexcept { return true; }
-
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr bool operator!=(monostate, monostate) noexcept { return false; }
-
template <class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
auto swap(variant<_Types...>& __lhs,
@@ -1755,17 +1736,6 @@
}
};
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<monostate> {
- using argument_type = monostate;
- using result_type = size_t;
-
- inline _LIBCPP_INLINE_VISIBILITY
- result_type operator()(const argument_type&) const _NOEXCEPT {
- return 66740831; // return a fundamentally attractive random value.
- }
-};
-
#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD