xtd 0.2.0
Loading...
Searching...
No Matches
xtd::expressions::placeholders< count > Struct Template Reference

Definition

template<size_t count>
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.

Namespace
xtd::expressions
Header
#include <xtd/expressions/placeholders>
Library
xtd.core
Examples
The following example shows how to use xtd::expressions::expression::placeholders.
#include <xtd/xtd>
auto main() -> int {
//auto expr1 = [](auto&& operand_one, auto&& operand_two) {return operand_one + operand_two;};
auto [operand_one, operand_two] = placeholders<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 _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
Generates a set of positional placeholders that can be decomposed using structured bindings to build ...
Definition placeholders.hpp:42

Public Member Functions

template<size_t index>
constexpr auto get () const noexcept

The documentation for this struct was generated from the following file: