compile-time initialization of objects need?

Weed resume755 at mail.ru
Fri Dec 26 02:55:30 PST 2008


In fact, the D is not contain a mechanism for compile-time
initialization of objects. Maybe add?

For example, that would be very usable for any objects which have
mathematical primitives.

Example:

struct S
{
    float[10] array;

    this( float f )
    {
        array[0] = f;
    }
}

void main()
{
    S a = S(8); // ok
    static S b = S(8); // error
}



More information about the Digitalmars-d mailing list