No UFCS with nested functions?

Nicholas Wilson iamthewilsonator at hotmail.com
Tue Nov 5 00:34:33 UTC 2019


On Monday, 4 November 2019 at 19:51:26 UTC, Tobias Pankrath wrote:
> Why does the following not work? It works, if I move the 'prop' 
> out of 'foo'.
>
> ---
> struct S {
> 	ubyte[12] bar;
> }
>
> bool foo (ref S s)
> {
>    static bool prop(const(ubyte)[] f) {
>       return f.length > 1;
>    }
> 	return s.bar[].prop;
> }
> ---
>
> Thanks!

https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/

struct S {
	ubyte[12] bar;
}

alias I(alias f) = f;

bool foo (ref S s)
{
    static bool prop(const(ubyte)[] f) {
       return f.length > 1;
    }
	return s.bar[].I!prop;
}


More information about the Digitalmars-d-learn mailing list