[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __variant / monostate.h
blobc5d2dacaf42051d92944eef00de53a44a1bd9012
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___VARIANT_MONOSTATE_H
11 #define _LIBCPP___VARIANT_MONOSTATE_H
13 #include <__compare/ordering.h>
14 #include <__config>
15 #include <__cstddef/size_t.h>
16 #include <__functional/hash.h>
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 # pragma GCC system_header
20 #endif
22 _LIBCPP_BEGIN_NAMESPACE_STD
24 #if _LIBCPP_STD_VER >= 17
26 struct _LIBCPP_TEMPLATE_VIS monostate {};
28 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(monostate, monostate) noexcept { return true; }
30 # if _LIBCPP_STD_VER >= 20
32 _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(monostate, monostate) noexcept {
33 return strong_ordering::equal;
36 # else // _LIBCPP_STD_VER >= 20
38 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator!=(monostate, monostate) noexcept { return false; }
40 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<(monostate, monostate) noexcept { return false; }
42 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>(monostate, monostate) noexcept { return false; }
44 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<=(monostate, monostate) noexcept { return true; }
46 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(monostate, monostate) noexcept { return true; }
48 # endif // _LIBCPP_STD_VER >= 20
50 template <>
51 struct _LIBCPP_TEMPLATE_VIS hash<monostate> {
52 using argument_type = monostate;
53 using result_type = size_t;
55 inline _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type&) const _NOEXCEPT {
56 return 66740831; // return a fundamentally attractive random value.
60 #endif // _LIBCPP_STD_VER >= 17
62 _LIBCPP_END_NAMESPACE_STD
64 #endif // _LIBCPP___VARIANT_MONOSTATE_H