Partial return type specification

bearophile bearophileHUGS at lycos.com
Mon Oct 4 04:33:59 PDT 2010


Daniel Murphy:

> Maybe typeof(return) is what you're looking for? *
> 
> auto foo()
> {
>     return map!("a * a")([1, 2, 3, 4]);
>     static assert(is(Unqual!(ForeachType!(typeof(return))) == int));
> }
> 
> * Not tested, I don't know if it works like this at all.

That works, thank you. Yes, I am looking for syntax sugar for that code.

Bye,
bearophile


More information about the Digitalmars-d mailing list