Possible way to achieve lazy loading with const objects

Kagamin spam at here.lot
Wed Sep 28 07:52:24 PDT 2011


Jonathan M Davis Wrote:

> Some programmers have expressed annoyance and/or disappointment that there is 
> no logical const of any kind in D.

isn't it trivial?

void setConst(T1,T2)(ref T1 dst, in T2 src)
{
  *cast()&dst=src;
}

const int v;
setConst(v,5);
assert(v==5);


More information about the Digitalmars-d mailing list