custom attribute proposal (yeah, another one)
Piotr Szturmaj
bncrbme at jadamspam.pl
Fri Apr 6 09:29:41 PDT 2012
Andrej Mitrovic wrote:
>> On 4/6/12, Piotr Szturmaj<bncrbme at jadamspam.pl> wrote:
>> struct Author { string name; }
>
> Also, let's not forget the glaring limitation of structs that almost
> everyone has ran into: you can't define a default ctor.
Static opCall() should do the trick:
struct Author
{
string name;
static Author opCall()
{
Author a;
a.name = "empty";
return a;
}
}
enum a = Author();
pragma(msg, a.name);
More information about the Digitalmars-d
mailing list