xtd 1.0.0
Loading...
Searching...
No Matches
expression.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "../type_of.hpp"
7#include <concepts>
8#include <ostream>
9#include <type_traits>
10
12namespace xtd {
14 namespace expressions {
16 template <size_t index>
17 struct argument;
19
84 struct expression {
86
94 template <size_t index>
97
99
108 template<typename left_t, typename right_t>
109 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
110 static constexpr auto add(left_t left, right_t right);
111
119 template<typename left_t, typename right_t>
120 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
121 static constexpr auto and_(left_t left, right_t right);
122
131 template<typename left_t, typename right_t>
132 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
133 static constexpr auto and_also(left_t left, right_t right);
134
142 template<typename left_t, typename right_t>
143 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
144 static constexpr auto compare_three_way(left_t left, right_t right);
145
152 template <auto constant_value>
153 static constexpr auto constant();
154
162 template<typename left_t, typename right_t>
163 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
164 static constexpr auto divide(left_t left, right_t right);
165
197 template<typename left_t, typename right_t>
198 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
199 static constexpr auto equal(left_t left, right_t right);
200
232 template<typename left_t, typename right_t>
233 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
234 static constexpr auto exclusive_or(left_t left, right_t right);
235
267 template<typename left_t, typename right_t>
268 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
269 static constexpr auto greater_than(left_t left, right_t right);
270
302 template<typename left_t, typename right_t>
303 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
304 static constexpr auto greater_than_or_equal(left_t left, right_t right);
305
337 template<typename left_t, typename right_t>
338 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
339 static constexpr auto left_shift(left_t left, right_t right);
340
372 template<typename left_t, typename right_t>
373 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
374 static constexpr auto less_than(left_t left, right_t right);
375
407 template<typename left_t, typename right_t>
408 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
409 static constexpr auto less_than_or_equal(left_t left, right_t right);
410
444 template<typename left_t, typename right_t>
445 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
446 static constexpr auto logical_and(left_t left, right_t right);
447
471 template<typename value_t>
472 requires std::is_base_of_v<expression, std::decay_t<value_t>>
473 static constexpr auto logical_not(value_t value);
474
508 template<typename left_t, typename right_t>
509 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
510 static constexpr auto logical_or(left_t left, right_t right);
511
543 template<typename left_t, typename right_t>
544 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
545 static constexpr auto modulo(left_t left, right_t right);
546
578 template<typename left_t, typename right_t>
579 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
580 static constexpr auto multiply(left_t left, right_t right);
581
605 template<typename value_t>
606 requires std::is_base_of_v<expression, std::decay_t<value_t>>
607 static constexpr auto negate(value_t value);
608
632 template<typename value_t>
633 requires std::is_base_of_v<expression, std::decay_t<value_t>>
634 static constexpr auto not_(value_t value);
635
667 template<typename left_t, typename right_t>
668 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
669 static constexpr auto not_equal(left_t left, right_t right);
670
702 template<typename left_t, typename right_t>
703 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
704 static constexpr auto or_(left_t left, right_t right);
705
739 template<typename left_t, typename right_t>
740 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
741 static constexpr auto or_else(left_t left, right_t right);
742
774 template<typename left_t, typename right_t>
775 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
776 static constexpr auto right_shift(left_t left, right_t right);
777
809 template<typename left_t, typename right_t>
810 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
811 static constexpr auto spaceship(left_t left, right_t right);
812
844 template<typename left_t, typename right_t>
845 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
846 static constexpr auto subtract(left_t left, right_t right);
847
871 template<typename value_t>
872 requires std::is_base_of_v<expression, std::decay_t<value_t>>
873 static constexpr auto unary_minus(value_t value);
874
898 template<typename value_t>
899 requires std::is_base_of_v<expression, std::decay_t<value_t>>
900 static constexpr auto unary_plus(value_t value);
901
937 template<typename type_t>
938 static constexpr auto value(type_t value);
939
971 template<typename left_t, typename right_t>
972 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
973 static constexpr auto xor_(left_t left, right_t right);
975
976 protected:
978
980 expression() = default;
982 };
983
985 template<typename type_t>
986 requires std::is_base_of_v<expression, std::decay_t<type_t>>
987 auto operator <<(std::ostream& os, const type_t& e) -> std::ostream& {return os << type_of(e);}
989 }
990}
991
constexpr auto operator<<(left_t left, right_t right)
Subtract the specified left and right operands.
Definition left_shift.hpp:127
@ e
The E key.
Definition console_key.hpp:96
The xtd::expressions namespace provides a lightweight, composable expression template framework for b...
Definition add.hpp:14
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::expressions::operator_precedence enum class.
The xtd::expressions::arg object is arg for all expressions.
Definition arg.hpp:31
static constexpr auto less_than_or_equal(left_t left, right_t right)
Less than or equal the specified left and right operands.
static constexpr auto less_than(left_t left, right_t right)
Less than the specified left and right operands.
static constexpr auto compare_three_way(left_t left, right_t right)
Compare three way the specified left and right operands.
static constexpr auto unary_minus(value_t value)
Unary minus the specified left and right operands.
static constexpr auto not_(value_t value)
Bitwise not the specified left and right operands.
static constexpr auto equal(left_t left, right_t right)
Equal the specified left and right operands.
static constexpr auto constant()
Gets the constant value.
static constexpr auto subtract(left_t left, right_t right)
Subtract the specified left and right operands.
static constexpr auto add(left_t left, right_t right)
Add the specified left and right operands.
static constexpr auto greater_than_or_equal(left_t left, right_t right)
Greater than or equzl the specified left and right operands.
static constexpr auto divide(left_t left, right_t right)
Divide the specified left and right operands.
static constexpr auto or_(left_t left, right_t right)
Bitwise or the specified left and right operands.
static constexpr auto modulo(left_t left, right_t right)
Modulo the specified left and right operands.
static constexpr auto logical_not(value_t value)
Logical not the specified left and right operands.
static constexpr auto logical_or(left_t left, right_t right)
Logical or the specified left and right operands.
static constexpr auto exclusive_or(left_t left, right_t right)
Bitwise xor the specified left and right operands.
static constexpr auto and_(left_t left, right_t right)
Bitwise and the specified left and right operands.
static constexpr auto right_shift(left_t left, right_t right)
Right shift the specified left and right operands.
static constexpr auto and_also(left_t left, right_t right)
Logical and the specified left and right operands.
static constexpr auto value(type_t value)
Gets the value value.
static constexpr auto spaceship(left_t left, right_t right)
Compare three way the specified left and right operands.
static constexpr auto logical_and(left_t left, right_t right)
Logical and the specified left and right operands.
static constexpr auto not_equal(left_t left, right_t right)
Not equal the specified left and right operands.
static constexpr auto unary_plus(value_t value)
Unary plus the specified left and right operands.
static constexpr auto xor_(left_t left, right_t right)
Bitwise xor the specified left and right operands.
static const xtd::expressions::argument< index > arg
Gets the index argument used by expression.
Definition expression.hpp:95
static constexpr auto left_shift(left_t left, right_t right)
Left shift the specified left and right operands.
static constexpr auto negate(value_t value)
Unary minus the specified left and right operands.
static constexpr auto or_else(left_t left, right_t right)
Logical or the specified left and right operands.
static constexpr auto multiply(left_t left, right_t right)
Multiply the specified left and right operands.
static constexpr auto greater_than(left_t left, right_t right)
Greater than the specified left and right operands.
Contains xtd::type_of methods.