On Wednesday, 4 December 2019 at 23:27:49 UTC, Steven Schveighoffer wrote:
void foo(alias f)()
{
   alias ConstType = const(typeof(f()));
   pragma(msg, ConstType);
}

I expressed myself poorly, what I am interested in is this:

struct node1 {int value; const(node1)* next;}
struct node2 {int value; immutable(node2)* next;}

alias node = node1; // may swap to node2

node f(){
    node tmp = {2019, null};
    return tmp;
}

void main() {
    // choose readonly as immutable if x can be cast as such
    // otherwise choose const
        readonly x = f();
}

Reply via email to