How use Predicate (alias pred = "a*b")?

Adam D. Ruppe destructionator at gmail.com
Thu May 13 21:38:25 UTC 2021


On Thursday, 13 May 2021 at 21:30:43 UTC, Marcone wrote:
> template foo(alias pred = "a*b"){
> 	void foo(int x, int y){
> 		writeln(x.unaryFun!pred);

First, you really shouldn't use these at all. instead of a 
string, just pass an actual function to the thing as the 
predicate.

but if you must use it, unaryFun has one argument, so just a. if 
you want a and b, two arguments, that's binaryFun.


More information about the Digitalmars-d-learn mailing list