xtd 0.2.0
Loading...
Searching...
No Matches

Definition

Contains expressions definitions.

Classes

struct  xtd::expressions::binary_expression
 The xtd::expressions::binary_expression is the base class for xtd::expressions::placeholder. More...
struct  xtd::expressions::conditional_expression
 The xtd::expressions::conditional_expression is the base class for xtd::expressions::placeholder. More...
struct  xtd::expressions::expression
 Provides the base class from which the classes that represent expression tree nodes are derived. It also contains static factory methods to create the various node types. This is an abstract class. More...
struct  xtd::expressions::expression_stream< expression_t >
 The xtd::expressions::expression_stream is the streamable class for expression objects. More...
struct  xtd::expressions::invocation_expression
 The xtd::expressions::invocation_expression is the base class for xtd::expressions::placeholder. More...
struct  xtd::expressions::placeholder< index >
 The xtd::expressions::placeholder object is placeholder for all expressions. More...
struct  xtd::expressions::placeholder_expression
 The xtd::expressions::placeholder_expression is the base class for xtd::expressions::placeholder. More...
struct  xtd::expressions::placeholders< count >
 Generates a set of positional placeholders that can be decomposed using structured bindings to build readable and composable expression templates. More...
struct  xtd::expressions::unary_expression
 The xtd::expressions::unary_expression is the base class for xtd::expressions::placeholder. More...
struct  xtd::expressions::value_expression
 The xtd::expressions::value_expression is the base class for xtd::expressions::placeholder. More...
struct  xtd::expressions::xor_expression< left_t, right_t >
 The xtd::expressions::xor_expression is the bitwise xor expression. More...

Enumerations

enum class  xtd::expressions::operator_precedence {
  xtd::expressions::operator_precedence::highest ,
  xtd::expressions::operator_precedence::placeholder ,
  xtd::expressions::operator_precedence::constant ,
  xtd::expressions::operator_precedence::value ,
  xtd::expressions::operator_precedence::scope_resolution ,
  xtd::expressions::operator_precedence::postfix_increment ,
  xtd::expressions::operator_precedence::postfix_decrement ,
  xtd::expressions::operator_precedence::functional_cast ,
  xtd::expressions::operator_precedence::function_call ,
  xtd::expressions::operator_precedence::subscript ,
  xtd::expressions::operator_precedence::member_access ,
  xtd::expressions::operator_precedence::method_access ,
  xtd::expressions::operator_precedence::prefix_increment ,
  xtd::expressions::operator_precedence::prefix_decrement ,
  xtd::expressions::operator_precedence::unary_plus ,
  xtd::expressions::operator_precedence::unary_minus ,
  xtd::expressions::operator_precedence::logical_not ,
  xtd::expressions::operator_precedence::bitwise_not ,
  xtd::expressions::operator_precedence::c_ctyle_cast ,
  xtd::expressions::operator_precedence::indirection ,
  xtd::expressions::operator_precedence::address_of ,
  xtd::expressions::operator_precedence::reflection ,
  xtd::expressions::operator_precedence::size_of ,
  xtd::expressions::operator_precedence::await ,
  xtd::expressions::operator_precedence::new_allocation ,
  xtd::expressions::operator_precedence::delete_dallocation ,
  xtd::expressions::operator_precedence::pointer_to_member ,
  xtd::expressions::operator_precedence::multiplication ,
  xtd::expressions::operator_precedence::division ,
  xtd::expressions::operator_precedence::modulo ,
  xtd::expressions::operator_precedence::addition ,
  xtd::expressions::operator_precedence::subtraction ,
  xtd::expressions::operator_precedence::bitwise_left ,
  xtd::expressions::operator_precedence::bitwise_right ,
  xtd::expressions::operator_precedence::three_way_comparison ,
  xtd::expressions::operator_precedence::relational ,
  xtd::expressions::operator_precedence::less ,
  xtd::expressions::operator_precedence::less_or_equal ,
  xtd::expressions::operator_precedence::greater ,
  xtd::expressions::operator_precedence::greater_or_equal ,
  xtd::expressions::operator_precedence::equality ,
  xtd::expressions::operator_precedence::equal ,
  xtd::expressions::operator_precedence::not_equal ,
  xtd::expressions::operator_precedence::bitwise_and ,
  xtd::expressions::operator_precedence::bitwise_xor ,
  xtd::expressions::operator_precedence::bitwise_or ,
  xtd::expressions::operator_precedence::logical_and ,
  xtd::expressions::operator_precedence::logical_or ,
  xtd::expressions::operator_precedence::ternary ,
  xtd::expressions::operator_precedence::throws ,
  xtd::expressions::operator_precedence::yield ,
  xtd::expressions::operator_precedence::assignment ,
  xtd::expressions::operator_precedence::compound_assignment ,
  xtd::expressions::operator_precedence::compound_sum_assignment ,
  xtd::expressions::operator_precedence::compound_difference_assignment ,
  xtd::expressions::operator_precedence::compound_product_assignment ,
  xtd::expressions::operator_precedence::compound_quotient_assignment ,
  xtd::expressions::operator_precedence::compound_modulo_assignment ,
  xtd::expressions::operator_precedence::compound_bitwise_left_assignment ,
  xtd::expressions::operator_precedence::compound_bitwise_right_assignment ,
  xtd::expressions::operator_precedence::compound_bitwise_and_assignment ,
  xtd::expressions::operator_precedence::compound_bitwise_xor_assignment ,
  xtd::expressions::operator_precedence::compound_bitwise_or_assignment ,
  xtd::expressions::operator_precedence::comma ,
  xtd::expressions::operator_precedence::lowest
}
 Specifies the operator precedence. More...

Functions

template<size_t count>
constexpr auto xtd::expressions::args ()
 Generates a set of positional placeholders that can be decomposed using structured bindings to build readable and composable expression templates.
template<typename member_t>
constexpr auto xtd::expressions::member (member_t member)
 The xtd::expressions::member is use to bind object member.
template<typename member_t>
constexpr auto xtd::expressions::member (const char *name, member_t member)
 The xtd::expressions::member is use to bind object member.
template<typename method_t, typename... args_t>
constexpr auto xtd::expressions::method (method_t method, args_t &&... args)
 The xtd::expressions::method is use to bind object method.
template<typename method_t, typename... args_t>
constexpr auto xtd::expressions::method (const char *name, method_t method, args_t &&... args)
 The xtd::expressions::method is use to bind object method.

Public Variables

template<size_t index>
constexpr xtd::expressions::placeholder< index > xtd::expressions::arg
 The xtd::expressions::arg instance is the index argument used by expression.
constexpr auto xtd::expressions::_
 The xtd::expressions::_ placeholder instance is used by expression that have only one argument.
constexpr auto xtd::expressions::_1
 The xtd::expressions::_1 placeholder instance is first argument used by expression.
constexpr auto xtd::expressions::_2
 The xtd::expressions::_2 placeholder instance is second argument used by expression.
constexpr auto xtd::expressions::_3
 The xtd::expressions::_3 placeholder instance is third argument used by expression.
constexpr auto xtd::expressions::_4
 The xtd::expressions::_4 placeholder instance is fourth argument used by expression.
constexpr auto xtd::expressions::_5
 The xtd::expressions::_5 placeholder instance is fifth argument used by expression.
constexpr auto xtd::expressions::_6
 The xtd::expressions::_6 placeholder instance is sixth argument used by expression.
constexpr auto xtd::expressions::_7
 The xtd::expressions::_7 placeholder instance is seventh argument used by expression.
constexpr auto xtd::expressions::_8
 The xtd::expressions::_8 placeholder instance is eighth argument used by expression.
constexpr auto xtd::expressions::_9
 The xtd::expressions::_9 placeholder instance is ninth argument used by expression.
constexpr auto xtd::expressions::_10
 The xtd::expressions::_10 placeholder instance is tenth argument used by expression.

Public Operators

template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator+ (left_t left, right_t right)
 Add the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator& (left_t left, right_t right)
 Subtract the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator<=> (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator/ (left_t left, right_t right)
 Divide the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator== (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator> (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator>= (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator<< (left_t left, right_t right)
 Subtract the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator< (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator<= (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator&& (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename value_t>
constexpr auto xtd::expressions::operator! (value_t value)
 Add the specified left and right operands.
template<typename expression_t, typename member_t>
constexpr auto xtd::expressions::operator* (expression_t expression, member_type< member_t > member)
 Bind member operator.
template<typename expression_t, typename member_t>
constexpr auto xtd::expressions::operator| (expression_t expression, member_type< member_t > member)
 Bind member operator.
template<typename expression_t, typename method_t, typename... stored_args_t>
constexpr auto xtd::expressions::operator* (expression_t expression, method_type< method_t, stored_args_t... > method)
 Bind method operator.
template<typename expression_t, typename method_t, typename... stored_args_t>
constexpr auto xtd::expressions::operator| (expression_t expression, method_type< method_t, stored_args_t... > method)
 Bind method alternative operator.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator% (left_t left, right_t right)
 Performs a modulo on the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator* (left_t left, right_t right)
 Multiply the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator!= (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename value_t>
constexpr auto xtd::expressions::operator~ (value_t value)
 Add the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator|| (left_t left, right_t right)
 Equal to the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator| (left_t left, right_t right)
 Subtract the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator>> (left_t left, right_t right)
 Subtract the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator- (left_t left, right_t right)
 Subtract the specified left and right operands.
template<typename value_t>
constexpr auto xtd::expressions::operator- (value_t value)
 Add the specified left and right operands.
template<typename value_t>
constexpr auto xtd::expressions::operator+ (value_t value)
 Add the specified left and right operands.
template<typename left_t, typename right_t>
constexpr auto xtd::expressions::operator^ (left_t left, right_t right)
 Subtract the specified left and right operands.

Public Functions

template<typename type_t>
constexpr decltype(auto) xtd::expressions::as_expression (type_t &&value)
 The xtd::expressions::as_expression method convert a type as xtd::expressions::expression.

Enumeration Type Documentation

◆ operator_precedence

#include <operator_precedence.hpp>

Specifies the operator precedence.

Namespace
xtd::expressions
Header
#include <xtd/expressions/operator_precedence>
Library
xtd.core
Remarks
See operator precedence for more information.
Enumerator
highest 

Represnets the highest operator precedence.

placeholder 

Represnets the placeholder operator precedence (_1).

constant 

Represnets the constant operator precedence (constant<42>).

value 

Represnets the constant operator precedence (42).

scope_resolution 

Represnets the scope resolution operator precedence (a::b).

postfix_increment 

Represnets the postfix increment operator precedence (a++).

postfix_decrement 

Represnets the postfix decrement operator precedence (a--).

functional_cast 

Represnets the functional cast operator precedence (type(a) type {a}).

function_call 

Represnets the function call operator precedence (a()).

subscript 

Represnets the subscript operator precedence (a[]).

member_access 

Represnets the member access operator precedence (a.b a->b).

method_access 

Represnets the method access operator precedence (a.b a->b).

prefix_increment 

Represnets the prefix increment operator precedence (++a).

prefix_decrement 

Represnets the prefix decrement operator precedence (--a).

unary_plus 

Represnets the unary plus operator precedence (+a).

unary_minus 

Represnets the unary minus operator precedence (-a).

logical_not 

Represnets the logical not operator precedence (!a).

bitwise_not 

Represnets the bitwise not operator precedence (~a).

c_ctyle_cast 

Represnets the c ctyle cast operator precedence ((type)a).

indirection 

Represnets the indirection operator precedence (*a).

address_of 

Represnets the address of operator precedence (&a).

reflection 

Represnets the reflection operator precedence (^^a).

size_of 

Represnets the size of operator precedence (sizeof).

await 

Represnets the await operator precedence (co_await).

new_allocation 

Represnets the new allocation operator precedence (new new[]).

delete_dallocation 

Represnets the delete dallocation operator precedence (delete delete[]).

pointer_to_member 

Represnets the pointer to member operator precedence (a.*.b a->*b).

multiplication 

Represnets the multiplication operator precedence (a * b).

division 

Represnets the division operator precedence (a / b).

modulo 

Represnets the modulo operator precedence (a % b).

addition 

Represnets the addition operator precedence (a + b).

subtraction 

Represnets the subtraction operator precedence (a - b).

bitwise_left 

Represnets the bitwise left operator precedence (a << b).

bitwise_right 

Represnets the bitwise right operator precedence (a >> b).

three_way_comparison 

Represnets the three way comparison operator precedence (a <=> b).

relational 

Represnets the relational operator precedence (a < b, a <= b a > b a >= b).

less 

Represnets the less operator precedence (a < b).

less_or_equal 

Represnets the less or equal operator precedence (a <= b).

greater 

Represnets the greater operator precedence (a > b).

greater_or_equal 

Represnets the greater or equal operator precedence (a >= b).

equality 

Represnets the equality operator precedence (a == b // a != b).

equal 

Represnets the equal operator precedence (a == b).

not_equal 

Represnets the not equal operator precedence (a != b).

bitwise_and 

Represnets the bitwise and operator precedence (a & b).

bitwise_xor 

Represnets the bitwise xor operator precedence (a ^ b).

bitwise_or 

Represnets the bitwise or operator precedence (a | b).

logical_and 

Represnets the logical and operator precedence (a && b).

logical_or 

Represnets the logical or operator precedence (a || b).

ternary 

Represnets the ternary operator precedence (a ? a : c).

throws 

Represnets the throws operator precedence (throw).

yield 

Represnets the yield operator precedence (co_yield).

assignment 

Represnets the assignment operator precedence (a = b).

compound_assignment 

Represnets the compound assignment operator precedence (a += b a += b a -= b a *= b a /= b a %= b a <<= b a >>= b a &= b a ^= b a |= b).

compound_sum_assignment 

Represnets the compound sum assignment operator precedence (a += b).

compound_difference_assignment 

Represnets the compound difference assignment operator precedence (a -= b).

compound_product_assignment 

Represnets the compound product assignment operator precedence (a *= b).

compound_quotient_assignment 

Represnets the compound quotient assignment operator precedence (a /= b).

compound_modulo_assignment 

Represnets the compound modulo assignment operator precedence (a %= b).

compound_bitwise_left_assignment 

Represnets the compound bitwise left assignment operator precedence (a <<= b).

compound_bitwise_right_assignment 

Represnets the compound bitwise right assignment operator precedence (a >>= b).

compound_bitwise_and_assignment 

Represnets the compound bitwise and assignment operator precedence (a &= b).

compound_bitwise_xor_assignment 

Represnets the compound bitwise xor assignment operator precedence (a ^= b).

compound_bitwise_or_assignment 

Represnets the compound bitwise or assignment (a |= b) operator precedence ().

comma 

Represnets the coma operator precedence (a, b).

lowest 

Represnets the lowest operator precedence.

Function Documentation

◆ operator+() [1/2]

template<typename left_t, typename right_t>
auto xtd::expressions::operator+ ( left_t left,
right_t right )
constexpr

#include <add_expression.hpp>

Add the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of add.
Namespace
xtd::expressions
Header
#include <xtd/expressions/add_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::add.
#include <xtd/xtd>
auto main() -> int {
// auto add1 = [](auto&& _) {return _ + 10;};
auto add1 = _ + 10;
println("add1 result => {}", add1(40));
auto add2 = expression::add(_, 10);
println("add2 result => {}", add2(40));
// auto add3 = [](auto&& _1, auto&& _2) {return _1 + _2;};
auto add3 = _1 + _2;
println("add3 result => {}", add3(40, 20));
auto add4 = expression::add(_1, _2);
println("add4 result => {}", add4(40, 20));
}
// This code produces the following output :
//
// add1 result => 50
// add2 result => 50
//
// add3 result => 60
// add4 result => 60
constexpr auto _
The xtd::expressions::_ placeholder instance is used by expression that have only one argument.
Definition args.hpp:66
constexpr auto _2
The xtd::expressions::_2 placeholder instance is second argument used by expression.
Definition args.hpp:117
constexpr auto _1
The xtd::expressions::_1 placeholder instance is first argument used by expression.
Definition args.hpp:92
void println()
Writes the current line terminator to the standard output stream using the specified format informati...
Definition println.hpp:167
static constexpr auto add(left_t left, right_t right)
Add the specified left and right operands.

◆ operator&()

template<typename left_t, typename right_t>
auto xtd::expressions::operator& ( left_t left,
right_t right )
constexpr

#include <and_expression.hpp>

Subtract the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of bitwise and.
Namespace
xtd::expressions
Header
#include <xtd/expressions/and_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::and_.
#include <xtd/xtd>
auto main() -> int {
// auto and1 = [](auto&& _) {return _ & 0x0F;};
auto and1 = _ & 0x0F;
println("and1 result => {:B}", and1(42));
auto and2 = expression::and_(_, 0x0F);
println("and2 result => {:B}", and2(42));
// auto and3 = [](auto&& _1, auto&& _2) {return _1 & _2;};
auto and3 = _1 & _2;
println("and3 result => {:B}", and3(42, 0xF0));
auto and4 = expression::and_(_1, _2);
println("and4 result => {:B}", and4(42, 0xF0));
}
// This code produces the following output :
//
// and1 result => 1010
// and2 result => 1010
//
// and3 result => 100000
// and4 result => 100000
static constexpr auto and_(left_t left, right_t right)
Bitwise and the specified left and right operands.

◆ args()

template<size_t count>
auto xtd::expressions::args ( )
constexpr

#include <args.hpp>

Generates a set of positional placeholders that can be decomposed using structured bindings to build readable and composable expression templates.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::args.
#include <xtd/xtd>
auto main() -> int {
//auto expr1 = [](auto&& operand_one, auto&& operand_two) {return operand_one + operand_two;};
auto [operand_one, operand_two] = args<2>();
auto expr1 = operand_one + operand_two;
println("expr1 result => {}", expr1(10, 20));
//auto expr2 = [](auto&& _1, auto&& _2) {return _1 + _2;};
auto expr2 = _1 + _2;
println("expr2 result => {}", expr2(10, 20));
}
// This code produces the following output :
//
// expr1 result => 30
// expr2 result => 30
constexpr auto args()
Generates a set of positional placeholders that can be decomposed using structured bindings to build ...
Definition args.hpp:43

◆ as_expression()

template<typename type_t>
decltype(auto) xtd::expressions::as_expression ( type_t && value)
constexpr

#include <as_expression.hpp>

The xtd::expressions::as_expression method convert a type as xtd::expressions::expression.

Parameters
valueThe value to convert. @raturn The result as xtd::expressions::expression.
Namespace
xtd::expressions
Header
#include <xtd/expressions/as_expression>
Library
xtd.core
Remarks
The xtd::expressions::as_expression method is used by xtd::expressions operators.

◆ operator<=>()

template<typename left_t, typename right_t>
auto xtd::expressions::operator<=> ( left_t left,
right_t right )
constexpr

#include <compare_three_way_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of compare three way.
Namespace
xtd::expressions
Header
#include <xtd/expressions/compare_three_way_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::compare_three_way_expression.
#include <xtd/xtd>
auto main() -> int {
// auto compare_three_way1 = [value](auto&& _) {return _ <=> 10;};
auto compare_three_way1 = _ <=> 10;
println("compare_three_way1 result => {}", compare_three_way1(42));
auto compare_three_way2 = expression::compare_three_way(_, 10);
println("compare_three_way2 result => {}", compare_three_way2(42));
//auto compare_three_way3 = [](auto&& _1, auto&& _2) {return _1 <=> _2;};
auto compare_three_way3 = _1 <=> _2;
println("compare_three_way3 result => {}", compare_three_way3(42, 42));
auto compare_three_way4 = expression::compare_three_way(_1, _2);
println("compare_three_way4 result => {}", compare_three_way4(42, 42));
}
// This code produces the following output :
//
// three_way_comparison1 result => greater
// three_way_comparison2 result => equivalent
static constexpr auto compare_three_way(left_t left, right_t right)
Compare three way the specified left and right operands.

◆ operator/()

template<typename left_t, typename right_t>
auto xtd::expressions::operator/ ( left_t left,
right_t right )
constexpr

#include <divide_expression.hpp>

Divide the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of division.
Namespace
xtd::expressions
Header
#include <xtd/expressions/divide_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::divide.
#include <xtd/xtd>
auto main() -> int {
// auto divide1 = [](auto&& _) {return _ / 10;};
auto divide1 = _ / 10;
println("divide1 result => {}", divide1(50));
auto divide2 = expression::divide(_, 10);
println("divide2 result => {}", divide2(50));
// auto divide3 = [](auto&& _1, auto&& _2) {return _1 / _2;};
auto divide3 = _1 / _2;
println("add3 result => {}", divide3(60, 15));
auto divide4 = expression::divide(_1, _2);
println("add4 result => {}", divide4(60, 15));
}
// This code produces the following output :
//
// divide1 result => 5
// divide2 result => 5
//
// divide3 result => 4
// divide4 result => 4
static constexpr auto divide(left_t left, right_t right)
Divide the specified left and right operands.

◆ operator==()

template<typename left_t, typename right_t>
auto xtd::expressions::operator== ( left_t left,
right_t right )
constexpr

#include <equal_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of equal.
Namespace
xtd::expressions
Header
#include <xtd/expressions/equal_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::equal.
#include <xtd/xtd>
auto main() -> int {
// auto equal1 = [](auto&& _) {return _ == 10;};
auto equal1 = _ == 10;
println("equal1 result => {}", equal1(42));
auto equal2 = expression::equal(_, 10);
println("equal2 result => {}", equal2(42));
// auto equal3 = [](auto&& _1, auto&& _2) {return _1 == _2;};
auto equal3 = _1 == _2;
println("equal3 result => {}", equal3(42, 42));
auto equal4 = expression::equal(_1, _2);
println("equal4 result => {}", equal4(42, 42));
}
// This code produces the following output :
//
// equal1 result => false
// equal2 result => false
//
// equal3 result => true
// equal4 result => true
static constexpr auto equal(left_t left, right_t right)
Equal the specified left and right operands.

◆ operator>()

template<typename left_t, typename right_t>
auto xtd::expressions::operator> ( left_t left,
right_t right )
constexpr

#include <greater_than_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of greater.
Namespace
xtd::expressions
Header
#include <xtd/expressions/greater_than_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::greater_than.
#include <xtd/xtd>
auto main() -> int {
// auto greater_than1 = [](auto&& _) {return _ > 10;};
auto greater_than1 = _ > 10;
println("greater_than1 result => {}", greater_than1(42));
auto greater_than2 = expression::greater_than(_, 10);
println("greater_than2 result => {}", greater_than2(42));
// auto greater_than3 = [](auto&& _1, auto&& _2) {return _1 > _2;};
auto greater_than3 = _1 > _2;
println("greater_than3 result => {}", greater_than3(42, 42));
auto greater_than4 = expression::greater_than(_1, _2);
println("greater_than4 result => {}", greater_than4(42, 42));
}
// This code produces the following output :
//
// greater_than1 result => true
// greater_than2 result => true
//
// greater_than3 result => false
// greater_than4 result => false
static constexpr auto greater_than(left_t left, right_t right)
Greater than the specified left and right operands.

◆ operator>=()

template<typename left_t, typename right_t>
auto xtd::expressions::operator>= ( left_t left,
right_t right )
constexpr

#include <greater_than_or_equal_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of greater or equal.
Namespace
xtd::expressions
Header
#include <xtd/expressions/greater_than_or_equal_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::greater_than_or_equal.
#include <xtd/xtd>
auto main() -> int {
// auto greater_than_or_equal1 = [](auto&& _) {return _ >= 10;};
auto greater_than_or_equal1 = _ > 10;
println("greater_than_or_equal1 result => {}", greater_than_or_equal1(42));
auto greater_than_or_equal2 = expression::greater_than_or_equal(_, 10);
println("greater_than_or_equal2 result => {}", greater_than2(42));
// auto greater_than_or_equal3 = [](auto&& _1, auto&& _2) {return _1 >= _2;};
auto greater_than_or_equal3 = _1 > _2;
println("greater_than_or_equal3 result => {}", greater_than_or_equal2(32, 42));
auto greater_than_or_equal4 = expression::greater_than_or_equal(_1, _2);
println("greater_than_or_equal4 result => {}", greater_than_or_equal4(32, 42));
}
// This code produces the following output :
//
// greater_than_or_equal1 result => true
// greater_than_or_equal2 result => true
//
// greater_than_or_equal3 result => false
// greater_than_or_equal4 result => false
static constexpr auto greater_than_or_equal(left_t left, right_t right)
Greater than or equzl the specified left and right operands.

◆ operator<<()

template<typename left_t, typename right_t>
auto xtd::expressions::operator<< ( left_t left,
right_t right )
constexpr

#include <left_shift_expression.hpp>

Subtract the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of bitwise left.
Namespace
xtd::expressions
Header
#include <xtd/expressions/left_shift_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::left_shift.
#include <xtd/xtd>
auto main() -> int {
// auto left_shift1 = [](auto&& _) {return _ << 2;};
auto left_shift1 = _ << 2;
println("left_shift1 result => {}", left_shift1(42));
auto left_shift2 = expression::left_shift(_, 2);
println("left_shift2 result => {}", left_shift2(42));
// auto left_shift3 = [](auto&& _1, auto&& _2) {return _1 << _2;};
auto left_shift3 = _1 << _2;
println("left_shift3 result => {}", left_shift3(42, 4));
auto left_shift4 = expression::left_shift(_1, _2);
println("left_shift4 result => {}", left_shift4(42, 4));
}
// This code produces the following output :
//
// left_shift1 result => 168
// left_shift2 result => 168
//
// left_shift3 result => 672
// left_shift4 result => 672
static constexpr auto left_shift(left_t left, right_t right)
Left shift the specified left and right operands.

◆ operator<()

template<typename left_t, typename right_t>
auto xtd::expressions::operator< ( left_t left,
right_t right )
constexpr

#include <less_than_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of less.
Namespace
xtd::expressions
Header
#include <xtd/expressions/less_than_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::less_than.
#include <xtd/xtd>
auto main() -> int {
// auto less_than1 = [](auto&& _) {return _ < 10;};
auto less_than1 = _ < 10;
println("less_than1 result => {}", less_than1(42));
auto less_than2 = expression::less_than(_, 10);
println("less_than2 result => {}", less_than2(42));
// auto less_than3 = [](auto&& _1, auto&& _2) {return _1 < _2;};
auto less_than3 = _1 < _2;
println("less_than3 result => {}", less_than3(42, 52));
auto less_than4 = expression::less_than(_1, _2);
println("less_than4 result => {}", less_than4(42, (52)));
}
// This code produces the following output :
//
// greater_than1 result => false
// greater_than2 result => false
//
// greater_than3 result => true
// greater_than4 result => true
static constexpr auto less_than(left_t left, right_t right)
Less than the specified left and right operands.

◆ operator<=()

template<typename left_t, typename right_t>
auto xtd::expressions::operator<= ( left_t left,
right_t right )
constexpr

#include <less_than_or_equal_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of less or equal.
Namespace
xtd::expressions
Header
#include <xtd/expressions/less_than_or_equal_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::less_than_or_equal.
#include <xtd/xtd>
auto main() -> int {
// auto less_than_or_equal1 = [](auto&& _) {return _ <= 10;};
auto less_than_or_equal1 = _ <= 10;
println("less_than_or_equal1 result => {}", less_than_or_equal1(42));
auto less_than_or_equal2 = expression::less_than_or_equal(_, 10);
println("less_than_or_equal2 result => {}", less_than_or_equal2(42));
// auto less_than_or_equal3 = [](auto&& _1, auto&& _2) {return _1 <= _2;};
auto less_than_or_equal3 = _1 <= _2;
println("less_than_or_equal3 result => {}", less_than_or_equal3(42, 52));
auto less_than_or_equal4 = expression::less_than_or_equal(_1, _2);
println("less_than_or_equal4 result => {}", less_than_or_equal4(42, (52)));
}
// This code produces the following output :
//
// greater_than1 result => false
// greater_than2 result => false
//
// greater_than3 result => true
// greater_than4 result => true
static constexpr auto less_than_or_equal(left_t left, right_t right)
Less than or equal the specified left and right operands.

◆ operator&&()

template<typename left_t, typename right_t>
auto xtd::expressions::operator&& ( left_t left,
right_t right )
constexpr

#include <logical_and_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of logical and.
Namespace
xtd::expressions
Header
#include <xtd/expressions/logical_and_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::logical_and.
#include <xtd/xtd>
auto main() -> int {
auto value = true;
// auto logical_and1 = [value](auto&& _) {return _ && value;};
auto logical_and1 = _ && value;
println("logical_and1 result => {}", logical_and1(42 % 2 == 0));
auto logical_and2 = expression::logical_and(_, value);
println("logical_and2 result => {}", logical_and2(42 % 2 == 0));
// auto logical_and3 = [](auto&& _1, auto&& _2) {return _1 && _2;};
auto logical_and3 = _1 && _2;
println("and_also3 result => {}", logical_and3(42 % 2 == 0, 42 % 8 == 0));
auto logical_and4 = expression::logical_and(_1, _2);
println("logical_and4 result => {}", logical_and4(42 % 2 == 0, 42 % 8 == 0));
}
// This code produces the following output :
//
// logical_and1 result => true
// logical_and2 result => true
//
// logical_and3 result => false
// logical_and4 result => false
static constexpr auto logical_and(left_t left, right_t right)
Logical and the specified left and right operands.
The xtd::expressions::value is the value wrapper.
Definition value.hpp:55

◆ operator!()

template<typename value_t>
auto xtd::expressions::operator! ( value_t value)
constexpr

#include <logical_not_expression.hpp>

Add the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of not.
Namespace
xtd::expressions
Header
#include <xtd/expressions/logical_not_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::logical_not.
#include <xtd/xtd>
auto main() -> int {
// auto logical_not1 = [value](auto&& _) {return !_;};
auto logical_not1 = !_;
println("logical_not1 result => {}", logical_not1(false));
auto logical_not2 = expression::logical_not(_);
println("logical_not2 result => {}", logical_not2(false));
}
// This code produces the following output :
//
// logical_not1 result => true
// logical_not2 result => true
static constexpr auto logical_not(value_t value)
Logical not the specified left and right operands.

◆ member() [1/2]

template<typename member_t>
auto xtd::expressions::member ( member_t member)
constexpr

#include <member_expression.hpp>

The xtd::expressions::member is use to bind object member.

Namespace
xtd::expressions
Header
#include <xtd/expressions/member_expression>
Library
xtd.core
Remarks
The xtd::expressions::member mzthod is used by xtd::expressions::operator ^().

◆ member() [2/2]

template<typename member_t>
auto xtd::expressions::member ( const char * name,
member_t member )
constexpr

#include <member_expression.hpp>

The xtd::expressions::member is use to bind object member.

Namespace
xtd::expressions
Header
#include <xtd/expressions/member_expression>
Library
xtd.core
Remarks
The xtd::expressions::member mzthod is used by xtd::expressions::operator ^().

◆ operator*() [1/3]

template<typename expression_t, typename member_t>
auto xtd::expressions::operator* ( expression_t expression,
member_type< member_t > member )
constexpr

#include <member_expression.hpp>

Bind member operator.

Parameters
expressionThe expression that associate to the binded member.
memberThe binded mehtod to execute.
Returns
The result of the binded member.
Namespace
xtd::expressions
Header
#include <xtd/expressions/member_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::not_equal_to_expression.
#include <xtd/xtd>
auto main() -> int {
struct foo {
int value;
};
auto mem1 = _*member(&foo::value);
println("mem1 result => {}", mem1(foo {42}));
}
// This code produces the following output :
//
// mem1 result => 42
constexpr auto member(member_t member)
The xtd::expressions::member is use to bind object member.
Definition member_expression.hpp:43

◆ operator|() [1/3]

template<typename expression_t, typename member_t>
auto xtd::expressions::operator| ( expression_t expression,
member_type< member_t > member )
constexpr

#include <member_expression.hpp>

Bind member operator.

Parameters
expressionThe expression that associate to the binded member.
memberThe binded mehtod to execute.
Returns
The result of the binded member.
Namespace
xtd::expressions
Header
#include <xtd/expressions/member_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::not_equal_to_expression.
#include <xtd/xtd>
auto main() -> int {
struct foo {
int value;
};
auto mem1 = _ | member(&foo::value);
println("mem1 result => {}", mem1(foo {42}));
}
// This code produces the following output :
//
// mem1 result => 42

◆ method() [1/2]

template<typename method_t, typename... args_t>
auto xtd::expressions::method ( method_t method,
args_t &&... args )
constexpr

#include <method_call_expression.hpp>

The xtd::expressions::method is use to bind object method.

Namespace
xtd::expressions
Header
#include <xtd/expressions/method_call_expression>
Library
xtd.core
Remarks
The xtd::expressions::method mzthod is used by xtd::expressions::operator ^().

◆ method() [2/2]

template<typename method_t, typename... args_t>
auto xtd::expressions::method ( const char * name,
method_t method,
args_t &&... args )
constexpr

#include <method_call_expression.hpp>

The xtd::expressions::method is use to bind object method.

Namespace
xtd::expressions
Header
#include <xtd/expressions/method_call_expression>
Library
xtd.core
Remarks
The xtd::expressions::method mzthod is used by xtd::expressions::operator ^().

◆ operator*() [2/3]

template<typename expression_t, typename method_t, typename... stored_args_t>
auto xtd::expressions::operator* ( expression_t expression,
method_type< method_t, stored_args_t... > method )
constexpr

#include <method_call_expression.hpp>

Bind method operator.

Parameters
expressionThe expression that associate to the binded method.
methodThe binded mehtod to execute.
Returns
The result of the binded method.
Namespace
xtd::expressions
Header
#include <xtd/expressions/method_call_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::not_equal_to_expression.
#include <xtd/xtd>
auto main() -> int {
auto fct1 = _*method(&string::to_upper);
println("fct1 result => {}", fct1("Hello"_s));
auto fct2 = _*method(overload<usize, usize>{}(&string::substring), 7, 6);
println("fct2 result => {}", fct2("Hello, World!"_s));
auto fct3 = _1*method(overload<usize, usize>{}(&string::substring), _2, _3);
println("fct3 result => {}", fct3("Hello, World!"_s, 7, 6));
}
// This code produces the following output :
//
// fct1 result => HELLO
// fct2 result => World!
// fct3 result => World!
auto substring(xtd::usize start_index) const -> basic_string
Definition basic_string.hpp:865
auto to_upper() const noexcept -> basic_string
Definition basic_string.hpp:944
constexpr auto _3
The xtd::expressions::_3 placeholder instance is third argument used by expression.
Definition args.hpp:142
constexpr auto method(method_t method, args_t &&... args)
The xtd::expressions::method is use to bind object method.
Definition method_call_expression.hpp:45

◆ operator|() [2/3]

template<typename expression_t, typename method_t, typename... stored_args_t>
auto xtd::expressions::operator| ( expression_t expression,
method_type< method_t, stored_args_t... > method )
constexpr

#include <method_call_expression.hpp>

Bind method alternative operator.

Parameters
expressionThe expression that associate to the binded method.
methodThe binded mehtod to execute.
Returns
The result of the binded method.
Namespace
xtd::expressions
Header
#include <xtd/expressions/method_call_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::not_equal_to_expression.
#include <xtd/xtd>
auto main() -> int {
auto fct1 = _ | method(&string::to_upper);
println("fct1 result => {}", fct1("Hello"_s));
auto fct2 = _ | method(overload<usize, usize>{}(&string::substring), 7, 6);
println("fct2 result => {}", fct2("Hello, World!"_s));
auto fct3 = _1 | method(overload<usize, usize>{}(&string::substring), _2, _3);
println("fct3 result => {}", fct3("Hello, World!"_s, 7, 6));
}
// This code produces the following output :
//
// fct1 result => HELLO
// fct2 result => World!
// fct3 result => World!

◆ operator%()

template<typename left_t, typename right_t>
auto xtd::expressions::operator% ( left_t left,
right_t right )
constexpr

#include <modulo_expression.hpp>

Performs a modulo on the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of division.
Namespace
xtd::expressions
Header
#include <xtd/expressions/modulo_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::modulo.
#include <xtd/xtd>
auto main() -> int {
// auto modulo1 = [](auto&& _) {return _ % 10;};
auto modulo1 = _ % 10;
println("modulo1 result => {}", modulo1(27));
auto modulo2 = expression::modulo(_, 10);
println("modulo2 result => {}", modulo2(27));
// auto modulo3 = [](auto&& _1, auto&& _2) {return _1 % _2;};
auto modulo3 = _1 % _2;
println("modulo3 result => {}", modulo3(64, 6));
auto modulo4 = expression::modulo(_1, _2);
println("modulo4 result => {}", modulo4(64, 6));
}
// This code produces the following output :
//
// mul1 result => 7
// mul2 result => 7
//
// mul3 result => 4
// mul4 result => 4
static constexpr auto modulo(left_t left, right_t right)
Modulo the specified left and right operands.

◆ operator*() [3/3]

template<typename left_t, typename right_t>
auto xtd::expressions::operator* ( left_t left,
right_t right )
constexpr

#include <multiply_expression.hpp>

Multiply the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of multiply.
Namespace
xtd::expressions
Header
#include <xtd/expressions/mltiply_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::multiply.
#include <xtd/xtd>
auto main() -> int {
// auto multiply1 = [](auto&& _) {return _ * 10;};
auto multiply1 = _ * 10;
println("multiply1 result => {}", multiply1(5));
auto multiply2 = expression::multiply(_, 10);
println("multiply2 result => {}", multiply2(5));
// auto multiply3 = [](auto&& _1, auto&& _2) {return _1 * _2;};
auto multiply3 = _1 * _2;
println("multiply3 result => {}", multiply3(4, 15));
auto multiply4 = expression::multiply(_1, _2);
println("multiply4 result => {}", multiply4(4, 15));
}
// This code produces the following output :
//
// mul1 result => 50
// mul2 result => 50
//
// mul3 result => 60
// mul4 result => 60
static constexpr auto multiply(left_t left, right_t right)
Multiply the specified left and right operands.

◆ operator!=()

template<typename left_t, typename right_t>
auto xtd::expressions::operator!= ( left_t left,
right_t right )
constexpr

#include <not_equal_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of not equal.
Namespace
xtd::expressions
Header
#include <xtd/expressions/not_equal_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::not_equal.
#include <xtd/xtd>
auto main() -> int {
// auto not_equal1 = [](auto&& _) {return _ != 10;};
auto not_equal1 = _ != 10;
println("not_equal1 result => {}", not_equal1(42));
auto not_equal2 = expression::not_equal(_, 10);
println("not_equal2 result => {}", not_equal2(42));
// auto not_equal3 = [](auto&& _1, auto&& _2) {return _1 != _2;};
auto not_equal3 = _1 != _2;
println("not_equal3 result => {}", not_equal3(42, 42));
auto not_equal4 = expression::not_equal(_1, _2);
println("not_equal4 result => {}", not_equal4(42, 42));
}
// This code produces the following output :
//
// not_equal1 result => true
// not_equal2 result => true
//
// not_equal3 result => false
// not_equal4 result => false
static constexpr auto not_equal(left_t left, right_t right)
Not equal the specified left and right operands.

◆ operator~()

template<typename value_t>
auto xtd::expressions::operator~ ( value_t value)
constexpr

#include <not_expression.hpp>

Add the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of bitwise not.
Namespace
xtd::expressions
Header
#include <xtd/expressions/not_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::not_.
#include <xtd/xtd>
auto main() -> int {
//auto not1 = [](auto _) {return static_cast<decltype(_)>(~_);};
auto not1 = ~_;
println("not1 result => {:B}", not1(42_u8));
auto not2 = expression::not_(_);
println("unary_plus2 result => {:B}", not2(42));
}
// This code produces the following output :
//
// not1 result => 11010101
// not2 result => 11010101
static constexpr auto not_(value_t value)
Bitwise not the specified left and right operands.

◆ operator||()

template<typename left_t, typename right_t>
auto xtd::expressions::operator|| ( left_t left,
right_t right )
constexpr

#include <or_else_expression.hpp>

Equal to the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of or.
Namespace
xtd::expressions
Header
#include <xtd/expressions/or_else_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::or_else_expression.
#include <xtd/xtd>
auto main() -> int {
auto or1 = _ || true;
println("or1 result => {}", or1(false));
auto or2 = _1 || _2;
println("or2 result => {}", or2(true, false));
}
// This code produces the following output :
//
// or1 result => true
// or2 result => true

◆ operator|() [3/3]

template<typename left_t, typename right_t>
auto xtd::expressions::operator| ( left_t left,
right_t right )
constexpr

#include <or_expression.hpp>

Subtract the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of bitwise or.
Namespace
xtd::expressions
Header
#include <xtd/expressions/or_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::or_.
#include <xtd/xtd>
auto main() -> int {
// auto or1 = [](auto&& _) {return _ | 0x0F;};
auto or1 = _ | 0x0F;
println("or1 result => {:B}", or1(42));
auto or2 = expression::or_(_, 0x0F);
println("or2 result => {:B}", or2(42));
// auto or3 = [](auto&& _1, auto&& _2) {return _1 | _2;};
auto or3 = _1 | _2;
println("or3 result => {:B}", or3(42, 0xF0));
auto or4 = expression::or_(_1, _2);
println("or4 result => {:B}", or4(42, 0xF0));
}
// This code produces the following output :
//
// or1 result => 101111
// or2 result => 101111
//
// or3 result => 11111010
// or4 result => 11111010
static constexpr auto or_(left_t left, right_t right)
Bitwise or the specified left and right operands.

◆ operator>>()

template<typename left_t, typename right_t>
auto xtd::expressions::operator>> ( left_t left,
right_t right )
constexpr

#include <right_shift_expression.hpp>

Subtract the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of bitwise right.
Namespace
xtd::expressions
Header
#include <xtd/expressions/right_shift_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::right_shift.
#include <xtd/xtd>
auto main() -> int {
// auto right_shift1 = [](auto&& _) {return _ >> 2;};
auto right_shift1 = _ >> 2;
println("right_shift1 result => {}", right_shift1(42));
auto right_shift2 = expression::right_shift(_, 2);
println("right_shift2 result => {}", right_shift2(42));
// auto right_shift3 = [](auto&& _1, auto&& _2) {return _1 >> _2;};
auto right_shift3 = _1 >> _2;
println("right_shift3 result => {}", right_shift3(42, 4));
auto right_shift4 = expression::right_shift(_1, _2);
println("right_shift4 result => {}", right_shift4(42, 4));
}
// This code produces the following output :
//
// right_shift1 result => 10
// right_shift2 result => 10
//
// right_shift3 result => 2
// right_shift4 result => 2
static constexpr auto right_shift(left_t left, right_t right)
Right shift the specified left and right operands.

◆ operator-() [1/2]

template<typename left_t, typename right_t>
auto xtd::expressions::operator- ( left_t left,
right_t right )
constexpr

#include <subtract_expression.hpp>

Subtract the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of subtract.
Namespace
xtd::expressions
Header
#include <xtd/expressions/subtract_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::subtract.
#include <xtd/xtd>
auto main() -> int {
// auto subtract1 = [](auto&& _) {return _ - 10;};
auto subtract1 = _ - 10;
println("subtract1 result => {}", subtract1(40));
auto subtract2 = expression::subtract(_, 10);
println("subtract2 result => {}", subtract2(40));
// auto subtract3 = [](auto&& _1, auto&& _2) {return _1 - _2;};
auto subtract3 = _1 - _2;
println("subtract3 result => {}", subtract3(40, 20));
auto subtract4 = expression::subtract(_1, _2);
println("subtract4 result => {}", subtract4(40, 20));
}
// This code produces the following output :
//
// subtract1 result => 30
// subtract2 result => 30
//
// subtract3 result => 20
// subtract4 result => 20
static constexpr auto subtract(left_t left, right_t right)
Subtract the specified left and right operands.

◆ operator-() [2/2]

template<typename value_t>
auto xtd::expressions::operator- ( value_t value)
constexpr

#include <unary_minus_expression.hpp>

Add the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of unary minus.
Namespace
xtd::expressions
Header
#include <xtd/expressions/unari_minus_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::unary_minus.
#include <xtd/xtd>
auto main() -> int {
// auto unary_minus1 = [value](auto&& _) {return -_;};
auto unary_minus1 = -_;
println("unary_minus1 result => {}", unary_minus1(42));
auto unary_minus2 = expression::unary_minus(_);
println("unary_minus2 result => {}", unary_minus2(42));
}
// This code produces the following output :
//
// unary_minus1 result => -42
// unary_minus2 result => -42
static constexpr auto unary_minus(value_t value)
Unary minus the specified left and right operands.

◆ operator+() [2/2]

template<typename value_t>
auto xtd::expressions::operator+ ( value_t value)
constexpr

#include <unary_plus_expression.hpp>

Add the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of unary plus.
Namespace
xtd::expressions
Header
#include <xtd/expressions/unari_plus_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::unary_plus.
#include <xtd/xtd>
auto main() -> int {
// auto unary_plus1 = [value](auto&& _) {return +_;};
auto unary_plus1 = +_;
println("unary_plus1 result => {}", unary_plus1(42));
auto unary_plus2 = expression::unary_plus(_);
println("unary_plus2 result => {}", unary_plus2(42));
}
// This code produces the following output :
//
// unary_plus1 result => 42
// unary_plus2 result => 42
static constexpr auto unary_plus(value_t value)
Unary plus the specified left and right operands.

◆ operator^()

template<typename left_t, typename right_t>
auto xtd::expressions::operator^ ( left_t left,
right_t right )
constexpr

#include <xor_expression.hpp>

Subtract the specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.
Returns
The result of bitwise xor.
Namespace
xtd::expressions
Header
#include <xtd/expressions/xor_expression>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::xor_.
#include <xtd/xtd>
auto main() -> int {
// auto or1 = [](auto&& _) {return _ ^ 0x0F;};
auto xor1 = _ ^ 0x0F;
println("xor1 result => {:B}", xor1(42));
auto xor2 = expression::xor_(_, 0x0F);
println("xor2 result => {:B}", xor2(42));
// auto xor3 = [](auto&& _1, auto&& _2) {return _1 ^ _2;};
auto xor3 = _1 ^ _2;
println("xor3 result => {:B}", xor3(42, 0xF0));
auto xor4 = expression::xor_(_1, _2);
println("xor4 result => {:B}", xor4(42, 0xF0));
}
// This code produces the following output :
//
// xor1 result => 100101
// xor2 result => 100101
//
// xor3 result => 11010010
// xor4 result => 11010010
static constexpr auto xor_(left_t left, right_t right)
Bitwise xor the specified left and right operands.

Variable Documentation

◆ arg

template<size_t index>
xtd::expressions::placeholder<index> xtd::expressions::arg
inlineconstexpr

#include <arg.hpp>

The xtd::expressions::arg instance is the index argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/arg>
Library
xtd.core
Remarks
The index start from 1 to N.
Examples
The following example shows how to use xtd::expressions::expression::arg.
#include <xtd/xtd>
auto main() -> int {
// auto placeholder1 = [](auto&& _) {return _;};
auto arg1 = _;
println("arg1 result => {}", arg1(10));
auto arg2 = _1;
println("arg2 result => {}", arg2(10));
auto arg3 = arg<1> {};
println("arg3 result => {}", arg3(10));
auto arg4 = expression::arg<1>();
println("arg4 result => {}", arg4(10));
// auto expr1 = [](auto&& _1, auto&& _2, auto&& _3) {return _1 + _2 + _3;};
auto expr1 = _1 + arg<2> + expression::arg<3>();
println("expr1 result => {}", expr1(10, 20, 30));
}
// This code produces the following output :
//
// arg1 result => 10
// arg2 result => 10
// arg3 result => 10
// arg4 result => 10
//
// expr1 result => 60
constexpr xtd::expressions::placeholder< index > arg
The xtd::expressions::arg instance is the index argument used by expression.
Definition arg.hpp:61
static constexpr auto arg()
Gets the index argument used by expression.

◆ _

auto xtd::expressions::_
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_ placeholder instance is used by expression that have only one argument.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_ is an alias on xtd::expressions::arg<1>
Examples
auto expr = _ + _;
println("expr result => {}", expr(10); // expr result => 20

◆ _1

auto xtd::expressions::_1
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_1 placeholder instance is first argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_1 is an alias on xtd::expressions::arg<1>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _1;
println("expr result => {}", expr(10)); // expr result => 20

◆ _2

auto xtd::expressions::_2
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_2 placeholder instance is second argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_2 is an alias on xtd::expressions::arg<1>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2;
println("expr result => {}", expr(10, 20)); // expr result => 30

◆ _3

auto xtd::expressions::_3
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_3 placeholder instance is third argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_3 is an alias on xtd::expressions::arg<3>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3;
println("expr result => {}", expr(10, 20, 30)); // expr result => 60

◆ _4

auto xtd::expressions::_4
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_4 placeholder instance is fourth argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_4 is an alias on xtd::expressions::arg<4>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3 + _4;
println("expr result => {}", expr(10, 20, 30, 40)); // expr result => 100
constexpr auto _4
The xtd::expressions::_4 placeholder instance is fourth argument used by expression.
Definition args.hpp:167

◆ _5

auto xtd::expressions::_5
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_5 placeholder instance is fifth argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_5 is an alias on xtd::expressions::arg<5>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3 + _4 + _5;
println("expr result => {}", expr(10, 20, 30, 40, 50)); // expr result => 150
constexpr auto _5
The xtd::expressions::_5 placeholder instance is fifth argument used by expression.
Definition args.hpp:192

◆ _6

auto xtd::expressions::_6
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_6 placeholder instance is sixth argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_6 is an alias on xtd::expressions::arg<6>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3 + _4 + _5 + _6;
println("expr result => {}", expr(10, 20, 30, 40, 50, 60)); // expr result => 210
constexpr auto _6
The xtd::expressions::_6 placeholder instance is sixth argument used by expression.
Definition args.hpp:217

◆ _7

auto xtd::expressions::_7
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_7 placeholder instance is seventh argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_7 is an alias on xtd::expressions::arg<7>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3 + _4 + _5 + _6 + _7;
println("expr result => {}", expr(10, 20, 30, 40, 50, 60, 70)); // expr result => 280
constexpr auto _7
The xtd::expressions::_7 placeholder instance is seventh argument used by expression.
Definition args.hpp:242

◆ _8

auto xtd::expressions::_8
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_8 placeholder instance is eighth argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_8 is an alias on xtd::expressions::arg<8>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8;
println("expr result => {}", expr(10, 20, 30, 40, 50, 60, 70, 80)); // expr result => 360
constexpr auto _8
The xtd::expressions::_8 placeholder instance is eighth argument used by expression.
Definition args.hpp:267

◆ _9

auto xtd::expressions::_9
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_9 placeholder instance is ninth argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_9 is an alias on xtd::expressions::arg<9>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9;
println("expr result => {}", expr(10, 20, 30, 40, 50, 60, 70, 80, 90)); // expr result => 450
constexpr auto _9
The xtd::expressions::_9 placeholder instance is ninth argument used by expression.
Definition args.hpp:292

◆ _10

auto xtd::expressions::_10
inlineconstexpr

#include <args.hpp>

The xtd::expressions::_10 placeholder instance is tenth argument used by expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/args>
Library
xtd.core
Remarks
The xtd::expressions::_10 is an alias on xtd::expressions::arg<10>
xtd::expressions contains the first ten entries from xtd::expressions::placeholder. If you need an eleventh entry or more, you can define them yourself as follows:
inline constexpr auto _11 = xtd::expressions::arg<11>;
inline constexpr auto _12 = xtd::expressions::arg<12>;
//...
inline constexpr auto _100 = xtd::expressions::arg<100>;
//...
Examples
auto expr = _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10;
println("expr result => {}", expr(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)); // expr result => 550
constexpr auto _10
The xtd::expressions::_10 placeholder instance is tenth argument used by expression.
Definition args.hpp:317