View source code Display the source code in std/functional.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.functional.adjoin - multiple declarations

Template adjoin

Takes multiple functions and adjoins them together. The result is a std.typecons.Tuple with one element per passed-in function. Upon invocation, the returned tuple is the adjoined results of all functions.

Arguments

template adjoin(F...);

Functions

Function name Description
adjoin

Note

In the special case where only a single function is provided (F.length == 1), adjoin simply aliases to the single passed function (F[0]).

Example

import std.functional, std.typecons;
static bool f1(int a) { return a != 0; }
static int f2(int a) { return a / 2; }
auto x = adjoin!(f1, f2)(5);
assert(is(typeof(x) == Tuple!(bool, int)));
assert(x[0] == true && x[1] == 2);

Alias adjoin

Takes multiple functions and adjoins them together. The result is a std.typecons.Tuple with one element per passed-in function. Upon invocation, the returned tuple is the adjoined results of all functions.

Declaration

alias adjoin(F...) = F[0];

Note

In the special case where only a single function is provided (F.length == 1), adjoin simply aliases to the single passed function (F[0]).

Example

import std.functional, std.typecons;
static bool f1(int a) { return a != 0; }
static int f2(int a) { return a / 2; }
auto x = adjoin!(f1, f2)(5);
assert(is(typeof(x) == Tuple!(bool, int)));
assert(x[0] == true && x[1] == 2);

Authors

Andrei Alexandrescu

License

Boost License 1.0.

Comments