How to initialize static array member variable?
Sebastian Schuberth
sschuberth at gmail.com
Fri Oct 1 00:02:10 PDT 2010
On 30.09.2010 22:04, Jonathan M Davis wrote:
> You could initialized it in a static constructor. e.g.
>
> static this()
> {
> X = Vector(1, 0, 0);
> }
I'll use that, thanks.
As a side note, I find the syntax quite unfortunate. It reads to me as
if the static constructor will only be called if the default constructor
is used (I know, this does not make sense as the static constructor will
be called before main, and before any non-static constructor). Still, I
wonder why not simply the Java syntax
static {
// ...
}
was adopted.
--
Sebastian Schuberth
More information about the Digitalmars-d-learn
mailing list