On Tuesday, October 09, 2012 20:09:56 Zhenya wrote:
> Ok.Then can I do my own .init property that can be executed in
> compile-time?

No. You directly initialize the member variables to what you want them to be, 
and that's the values that they have in the init property. You can't have 
anything like a function or constructor to initialize them all together. 
However, you _can_ use the results of functions to initialize the member 
variables if the functions will work at compile time. e.g.

struct S
{
 int i = foo();
 string s = bar("joe");
}

int foo()
{
 return 7;
}

string bar(string str)
{
 return str ~ " schmoe";
}

assert(S.init == S(7, "joe schmoe"));

- Jonathan M Davis

Reply via email to