Function template declaration mystery...

Robert M. Münch robert.muench at saphirion.com
Wed Feb 28 19:47:32 UTC 2018


On 2018-02-28 18:01:50 +0000, TheFlyingFiddle said:
> 
> Testing this with:
> 
> auto foo(alias f, A)(auto ref A a) { return f(a); }
> 
> I can call foo either like this:
> 
> foo!(x => x + x)(1);
> or
> 1.foo!(x => x + x);
> 
> but these will give errors
> 
> foo(1, x => x + x); //Error
> 1.foo(x => x + x); // Error
> 
> I don't see how you can get that kind of behavior...

Well, I stripped things trying to the core of where I'm struggeling. 
The 'a' in my code is a static and of course there is much more around 
going on.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list