Structure initialization

Sheff sheffmail at mail.ru
Mon May 7 03:51:07 PDT 2007


Hi, everyone!
Can anybody tell me how to partially initialize a structure in place, i.e:
I have a structure:

struct Props
{
int flag = 1;
int state = 0;
}
and a function:
void f(Props p);

And I want to pass an instance of Props to f with only some fields initialized, right now I have to write like this:
f(Props(1,1000));
but I want to be able to write something like this:
f(Props(state:1000));
But that doesn't work, is there a way I can make it work ?



More information about the Digitalmars-d mailing list