31 :
operands{std::forward<Types>(args)...} {}
35 static constexpr std::size_t
arity =
sizeof...(Types);
36 static constexpr std::string_view
op = Op;
45 return {std::forward<T>(expr_lhs)};
50template <
typename T,
typename U>
52 return {std::get<0>(std::move(expr_lhs).operands), std::forward<U>(expr_rhs)};
55template <
typename T,
typename U>
57 return {std::get<0>(std::move(expr_lhs).operands), std::forward<U>(expr_rhs)};
60template <
typename T,
typename U>
61constexpr DecomposedExpr<
"<", T, U> operator<(DecomposedExpr<"", T>&& expr_lhs, U&& expr_rhs) {
62 return {std::get<0>(std::move(expr_lhs).operands), std::forward<U>(expr_rhs)};
65template <
typename T,
typename U>
66constexpr DecomposedExpr<
"<=", T, U>
operator<=(DecomposedExpr<"", T>&& expr_lhs, U&& expr_rhs) {
67 return {std::get<0>(std::move(expr_lhs).operands), std::forward<U>(expr_rhs)};
70template <
typename T,
typename U>
71constexpr DecomposedExpr<
">", T, U> operator>(DecomposedExpr<"", T>&& expr_lhs, U&& expr_rhs) {
72 return {std::get<0>(std::move(expr_lhs).operands), std::forward<U>(expr_rhs)};
75template <
typename T,
typename U>
77 return {std::get<0>(std::move(expr_lhs).operands), std::forward<U>(expr_rhs)};
88#define STATIC_ASSERT_PRE \
89 "=====================================================================================================" \
90 "=========================================================== !!!!!!!!!!!!!!!!! " \
94#define STATIC_ASSERT_POST \
95 " is not supported for decomposition! Wrap it in parentheses." \
96 " !!!!!!!!!!!!!!!!! " \
97 "=====================================================================================================" \
98 "=========================================================== "
101#define STATIC_ASSERT_CHAINED_POST \
102 " is not supported to be chained with decomposition. Wrap it in parentheses, or fix the logic error." \
103 " !!!!!!!!!!!!!!!!! " \
104 "=====================================================================================================" \
105 "=========================================================== "
115#define DISABLE_OPERATOR(op) \
116 template <StaticString Op, typename... Ts, typename U> \
117 constexpr void operator op(DecomposedExpr<Op, Ts...>&& , U&& ) { \
118 static_assert(always_false_v<U>, STATIC_ASSERT_PRE #op STATIC_ASSERT_POST); \
120#define DISABLE_CHAINED_OPERATOR(op) \
121 template <StaticString Op, typename... Ts, typename U> \
122 constexpr void operator op(DecomposedExpr<Op, Ts...>&& , U&& ) { \
123 static_assert(always_false_v<U>, STATIC_ASSERT_PRE #op STATIC_ASSERT_CHAINED_POST); \
152#undef DISABLE_CHAINED_OPERATOR
153#undef DISABLE_OPERATOR
154#undef STATIC_ASSERT_POST
155#undef STATIC_ASSERT_PRE
A non-movable and non-copyable type.
Definition class_traits.hpp:38
A fully compile-time capable string type Guaranteed to be null-terminated.
Definition static_string.hpp:59
#define STATIC_ASSERT_POST
Definition decomposer.hpp:94
#define COMMA
Definition decomposer.hpp:141
#define DISABLE_OPERATOR(op)
Definition decomposer.hpp:115
#define STATIC_ASSERT_PRE
Definition decomposer.hpp:88
Definition asm_buffer.hpp:20
constexpr bool always_false_v
Definition always_false.hpp:16
constexpr DecomposedExpr<">=", T, U > operator>=(DecomposedExpr<"", T > &&expr_lhs, U &&expr_rhs)
Definition decomposer.hpp:76
constexpr DecomposedExpr<"==", T, U > operator==(DecomposedExpr<"", T > &&expr_lhs, U &&expr_rhs)
Definition decomposer.hpp:51
constexpr DecomposedExpr<"!=", T, U > operator!=(DecomposedExpr<"", T > &&expr_lhs, U &&expr_rhs)
Definition decomposer.hpp:56
constexpr DecomposedExpr<"", T > operator<=(Decomposer, T &&expr_lhs)
Definition decomposer.hpp:44
DISABLE_CHAINED_OPERATOR(==)
StaticString(const char(&input)[N]) -> StaticString< N - 1 >
Stores references to rhs and lhs of a comparison expression, serving as an interface to the "decompos...
Definition decomposer.hpp:29
std::tuple< Types &&... > operands
Definition decomposer.hpp:33
static constexpr std::size_t arity
Definition decomposer.hpp:35
static constexpr std::string_view op
Definition decomposer.hpp:36
constexpr DecomposedExpr< Op, Types... > & operator=(const U &)
operator= is disabled via static_assert(false, ...)
Just a tag type for operator overloading purposes Intended use is on the lhs of operator<= e....
Definition decomposer.hpp:22