View source code
Display the source code in std/functional.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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.

Alias std.functional.adjoin

Takes multiple functions and adjoins them together.

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

Parameters

NameDescription
F the call-able(s) to adjoin

Returns

A new function which returns a Tuple. Each of the elements of the tuple will be the return values of F.

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.typecons : Tuple;
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.