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.
Template std.functional.binaryReverseArgs
Binary predicate that reverses the order of arguments, e.g., given
pred(a, b)
, returns pred(b, a)
.
template binaryReverseArgs(alias pred)
;
DEPRECATED: Use reverseArgs
Contained Functions
Name | Description |
---|---|
binaryReverseArgs |
Parameters
Name | Description |
---|---|
pred | A callable |
Returns
A function which calls pred
after reversing the given parameters
Example
alias gt = binaryReverseArgs!(binaryFun!("a < b"));
assert(gt(2, 1) && !gt(1, 1));
Example
int x = 42;
bool xyz(int a, int b) { return a * x < b / x; }
auto foo = &xyz;
foo(4, 5);
alias zyx = binaryReverseArgs!(foo);
writeln(zyx(5, 4)); // foo(4, 5)
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.