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.binaryFun

Transforms a string representing an expression into a binary function. The string must either use symbol names a and b as the parameters or provide the symbols via the parm1Name and parm2Name arguments. If fun is not a string, binaryFun aliases itself away to fun.

Arguments

template binaryFun(alias fun, string parm1Name, string parm2Name);

Example

alias less = binaryFun!("a < b");
assert(less(1, 2) && !less(2, 1));
alias greater = binaryFun!("a > b");
assert(!greater("1", "2") && greater("2", "1"));

Authors

Andrei Alexandrescu

License

Boost License 1.0.

Comments