On Thursday, 24 March 2016 at 08:13:27 UTC, Edwin van Leeuwen wrote:
Yeah this is one of the downsides of voldermort types. In these cases typeof and ReturnType are your friend. It often takes me a couple of tries to get it right, but the following seems to work:

import std.traits : ReturnType;
import std.range : iota;
class A
{
    ReturnType!(A.testIter4) member;
    auto testIter4()
    {
        return iota(0,5);
    }
}

void main()
{

     A a = new A();
     a.member = a.testIter4();
        
}

Ah... thanks! The "ReturnType" is what I looked for. This also makes some kind of semantic statement about "how slim should be the interface of my class members"...

Reply via email to