29 template<
typename left_t,
typename right_t>
30 struct add : binary_expression {
42 constexpr add() =
default;
47 constexpr add(left_t left, right_t right) : left {std::move(left)}, right {std::move(right)} {}
56 template<
typename... args_t>
57 constexpr auto operator()(args_t&&...
args)
const {
return left(std::forward<args_t>(
args)...) + right(std::forward<args_t>(
args)...);}
61 friend inline auto operator <<(std::ostream& os,
const add&
e) -> std::ostream& {
return os <<
expression_stream {
e.left,
e.precedence} <<
" + " << expression_stream {
e.right,
e.precedence};}
65 [[no_unique_address]] left_t left;
66 [[no_unique_address]] right_t right;
70 template<
typename left_t,
typename right_t>
71 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
75 return expressions::add<std::decay_t<
decltype(left_expression)>, std::decay_t<
decltype(right_expression)>> {std::move(left_expression), std::move(right_expression)};
98 template<
typename left_t,
typename right_t>
Contains xtd::expressions::as_expression methods.
Contains xtd::expressions::binary_expression struct.
The xtd::expressions::expression_operand object is expression operand concept.
Definition expression_operand.hpp:27
Contains xtd::expressions::expression_operand concept.
Contains xtd::expressions::expression_stream struct.
constexpr auto operator<<(left_t left, right_t right)
Subtract the specified left and right operands.
Definition left_shift.hpp:127
operator_precedence
Specifies the operator precedence.
Definition operator_precedence.hpp:22
constexpr auto operator+(left_t left, right_t right)
Add the specified left and right operands.
Definition add.hpp:100
@ addition
Represnets the addition operator precedence (a + b).
Definition operator_precedence.hpp:84
constexpr decltype(auto) as_expression(type_t &&value)
The xtd::expressions::as_expression method convert a type as xtd::expressions::expression.
Definition as_expression.hpp:33
@ 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
The xtd::expressions::add is the add expression.
Definition add.hpp:30
constexpr add()=default
Initialize a new xtd::expressions::add object.
constexpr auto operator()(args_t &&... args) const
Add the specified arguments.
Definition add.hpp:57
static constexpr operator_precedence precedence
The operator precedence. That contains one of xtd::expressions::operator_precedence values.
Definition add.hpp:35
constexpr add(left_t left, right_t right)
Initialize a new xtd::expressions::add object with specified left and right operands.
Definition add.hpp:47
Generates a set of positional args that can be decomposed using structured bindings to build readable...
Definition args.hpp:42
The xtd::expressions::expression_stream is the streamable class for expression objects.
Definition expression_stream.hpp:23
static constexpr auto add(left_t left, right_t right)
Add the specified left and right operands.