DMD won't compile re-init of variable

Simon lehmayr+d at gmail.com
Thu Jan 30 21:09:41 UTC 2020


Hi dlang community,

I'm trying to implement a "reset" functionality which should 
revert all variables to the program start initial state.

Example:

import Graph;
protected Edge[string] m_string2edge;

int main()
{
     // adding some elements
     // not important how it works
     // m_string2edge[name] = e;

     // resetting it
     m_string2edge = null;
     m_string2edge = new Edge[string]; // <- won't compile

     return 0;
}

How do I revert my variable to the init state?

Thanks in advance,
Simon



More information about the Digitalmars-d-learn mailing list