How to get field default value at CT

2017-05-06 Thread Mike B Johnson via Digitalmars-d-learn
I'd like to get the value assign to a field at CT. struct { int x = 3434; } I'd like to get the assigned "value" 3434 for x at CT.

Re: How to get field default value at CT

2017-05-06 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 6 May 2017 at 21:40:24 UTC, Mike B Johnson wrote: I'd like to get the value assign to a field at CT. struct { int x = 3434; } I'd like to get the assigned "value" 3434 for x at CT. Use the .init property: struct S { int x = 3434; } unittest { static assert(S.init.x