xtd 1.0.0
Loading...
Searching...
No Matches
xtd::expressions::and_< left_t, right_t > Struct Template Reference
Inheritance diagram for xtd::expressions::and_< left_t, right_t >:
xtd::expressions::binary_expression xtd::expressions::expression

Definition

template<typename left_t, typename right_t>
struct xtd::expressions::and_< left_t, right_t >

The xtd::expressions::and_ is the bitwise and expression.

Namespace
xtd::expressions
Header
#include <xtd/expressions/and>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::and_.
#include <xtd/xtd>
auto main() -> int {
// auto expr1 = [](auto&& _) {return _ & 0x0F;};
auto expr1 = _ & 0x0F;
println("expr1 = {:B}", expr1(42));
auto expr2 = expression::and_(_, 0x0F);
println("expr2 = {:B}", expr2(42));
// auto expr3 = [](auto&& _1, auto&& _2) {return _1 & _2;};
auto expr3 = _1 & _2;
println("expr3 = {:B}", expr3(42, 0xF0));
auto expr4 = expression::and_(_1, _2);
println("expr4 = {:B}", expr4(42, 0xF0));
}
// This code produces the following output :
//
// expr1 = 1010
// expr2 = 1010
//
// expr3 = 100000
// expr4 = 100000
constexpr auto _
The xtd::expressions::_ arg instance is used by expression that have only one argument.
Definition args.hpp:68
constexpr auto _2
The xtd::expressions::_2 arg instance is second argument used by expression.
Definition args.hpp:119
constexpr auto _1
The xtd::expressions::_1 arg instance is first argument used by expression.
Definition args.hpp:94
auto println(FILE *file) -> void
Writes the current line terminator to the file output stream using the specified format information.
Definition println.hpp:15
static constexpr auto and_(left_t left, right_t right)
Bitwise and the specified left and right operands.
Remarks
The xtd::expressions::and_ struct is used by xtd::expressions::expression::and_ expression.

Public Fields

static constexpr operator_precedence precedence
 The operator precedence. That contains one of xtd::expressions::operator_precedence values.

Public Constructors

constexpr and_ ()=default
 Initialize a new xtd::expressions::and_ object.
constexpr and_ (left_t left, right_t right)
 Initialize a new xtd::expressions::and_ object with specified left and right operands.

Public Operators

template<typename... args_t>
constexpr auto operator() (args_t &&... args) const
 Bitwise and the specified arguments.

Additional Inherited Members

Constructor & Destructor Documentation

◆ and_() [1/2]

template<typename left_t, typename right_t>
xtd::expressions::and_< left_t, right_t >::and_ ( )
constexprdefault

Initialize a new xtd::expressions::and_ object.

◆ and_() [2/2]

template<typename left_t, typename right_t>
xtd::expressions::and_< left_t, right_t >::and_ ( left_t left,
right_t right )
inlineconstexpr

Initialize a new xtd::expressions::and_ object with specified left and right operands.

Parameters
leftThe left operand.
rightThe right operand.

Member Function Documentation

◆ operator()()

template<typename left_t, typename right_t>
template<typename... args_t>
auto xtd::expressions::and_< left_t, right_t >::operator() ( args_t &&... args) const
inlineconstexpr

Bitwise and the specified arguments.

Parameters
argsthe arguments to bitwise and.
Returns
The result of bitwise and.

Member Data Documentation

◆ precedence

template<typename left_t, typename right_t>
operator_precedence xtd::expressions::and_< left_t, right_t >::precedence
staticconstexpr

The operator precedence. That contains one of xtd::expressions::operator_precedence values.


The documentation for this struct was generated from the following file:
  • xtd.core/include/xtd/expressions/and.hpp