VCCC  2024.05
VisualCamp Common C++ library
monostate.hpp
Go to the documentation of this file.
1 //
2 // Created by YongGyu Lee on 11/3/23.
3 //
4 
5 #ifndef VCCC_VARIANT_MONOSTATE_HPP
6 #define VCCC_VARIANT_MONOSTATE_HPP
7 
8 #include <functional>
9 
12 
13 namespace vccc {
14 
15 
16 struct monostate {};
17 
18 constexpr bool operator==(monostate, monostate) noexcept { return true; }
19 constexpr bool operator!=(monostate, monostate) noexcept { return false; }
20 constexpr bool operator< (monostate, monostate) noexcept { return false; }
21 constexpr bool operator> (monostate, monostate) noexcept { return false; }
22 constexpr bool operator<=(monostate, monostate) noexcept { return true; }
23 constexpr bool operator>=(monostate, monostate) noexcept { return true; }
24 
25 
26 } // namespace vccc
27 
28 template<>
29 struct std::hash<::vccc::monostate> {
30  std::size_t operator()(const ::vccc::monostate&) const noexcept {
31  return 1998;
32  }
33 };
34 
36 
37 #endif // VCCC_VARIANT_MONOSTATE_HPP
constexpr bool operator>(const optional< T > &lhs, const optional< U > &rhs)
Definition: optional.h:522
constexpr bool operator<(const optional< T > &lhs, const optional< U > &rhs)
Definition: optional.h:504
constexpr bool operator<=(const optional< T > &lhs, const optional< U > &rhs)
Definition: optional.h:513
constexpr bool operator>=(const optional< T > &lhs, const optional< U > &rhs)
Definition: optional.h:531
Definition: directory.h:12
constexpr bool operator!=(const MatrixBase< E1 > &lhs, const MatrixBase< E2 > &rhs)
Definition: mat_expr_operations.hpp:23
constexpr bool operator==(const MatrixBase< E1 > &lhs, const MatrixBase< E2 > &rhs)
Definition: mat_expr_operations.hpp:15
std::size_t operator()(const ::vccc::monostate &) const noexcept
Definition: monostate.hpp:30
Definition: monostate.hpp:16