xtd 1.0.0
Loading...
Searching...
No Matches
greater_than.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "as_expression.hpp"
9#include <utility>
10
12namespace xtd {
14 namespace expressions {
53 template<typename left_t, typename right_t>
54 struct greater_than : binary_expression {
56
61
63
66 constexpr greater_than() = default;
67
71 constexpr greater_than(left_t left, right_t right) : left {std::move(left)}, right {std::move(right)} {}
73
75
80 template<typename... args_t>
81 constexpr auto operator()(args_t&&... args) const {return left(std::forward<args_t>(args)...) > right(std::forward<args_t>(args)...);}
83
85 friend inline auto operator <<(std::ostream& os, const greater_than& e) -> std::ostream& {return os << expression_stream {e.left, e.precedence} << " > " << expression_stream {e.right, e.precedence};}
87
88 private:
89 [[no_unique_address]] left_t left;
90 [[no_unique_address]] right_t right;
91 };
92
94 template<typename left_t, typename right_t>
95 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
96 constexpr auto expression::greater_than(left_t left, right_t right) {
97 auto left_expression = as_expression(left);
98 auto right_expression = as_expression(right);
99 return expressions::greater_than<std::decay_t<decltype(left_expression)>, std::decay_t<decltype(right_expression)>> {std::move(left_expression), std::move(right_expression)};
100 }
102
104
146 template<typename left_t, typename right_t>
148 constexpr auto operator >(left_t left, right_t right) {return expression::greater_than(std::move(left), std::move(right));}
150 }
151}
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)
Equal to the specified left and right operands.
Definition greater_than.hpp:148
@ greater
Represnets the greater operator precedence (a > b).
Definition operator_precedence.hpp:100
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
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 greater_than(left_t left, right_t right)
Greater than the specified left and right operands.
The xtd::expressions::greater_than is the greater expression.
Definition greater_than.hpp:54
static constexpr operator_precedence precedence
The operator precedence. That contains one of xtd::expressions::operator_precedence values.
Definition greater_than.hpp:59
constexpr greater_than()=default
Initialize a new xtd::expressions::greater_than object.
constexpr auto operator()(args_t &&... args) const
Equal to the specified arguments.
Definition greater_than.hpp:81
constexpr greater_than(left_t left, right_t right)
Initialize a new xtd::expressions::greater_than object with specified left and right operands.
Definition greater_than.hpp:71