File indexing completed on 2026-05-03 08:14:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___VARIANT_MONOSTATE_H
0011 #define _LIBCPP___VARIANT_MONOSTATE_H
0012
0013 #include <__compare/ordering.h>
0014 #include <__config>
0015 #include <__cstddef/size_t.h>
0016 #include <__functional/hash.h>
0017
0018 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0019 # pragma GCC system_header
0020 #endif
0021
0022 _LIBCPP_BEGIN_NAMESPACE_STD
0023
0024 #if _LIBCPP_STD_VER >= 17
0025
0026 struct _LIBCPP_TEMPLATE_VIS monostate {};
0027
0028 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(monostate, monostate) noexcept { return true; }
0029
0030 # if _LIBCPP_STD_VER >= 20
0031
0032 _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(monostate, monostate) noexcept {
0033 return strong_ordering::equal;
0034 }
0035
0036 # else
0037
0038 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator!=(monostate, monostate) noexcept { return false; }
0039
0040 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<(monostate, monostate) noexcept { return false; }
0041
0042 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>(monostate, monostate) noexcept { return false; }
0043
0044 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<=(monostate, monostate) noexcept { return true; }
0045
0046 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(monostate, monostate) noexcept { return true; }
0047
0048 # endif
0049
0050 template <>
0051 struct _LIBCPP_TEMPLATE_VIS hash<monostate> {
0052 using argument_type = monostate;
0053 using result_type = size_t;
0054
0055 inline _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type&) const _NOEXCEPT {
0056 return 66740831;
0057 }
0058 };
0059
0060 #endif
0061
0062 _LIBCPP_END_NAMESPACE_STD
0063
0064 #endif