Still writing my 'cell' class that needs a look-up table
to be created before any cells are accessed. Right now I have
a static method cell::create_lo okup_table() that does the job,
but I was wondering if there was some kind of a "static constructor"
that would do this automatically upon the construction of the
first cell instance? Sure I could make a normal constructor for
'cell' that would check a flag and create the look-up table if
it was not created already, but keeping in mind that I'd have
arrays of 1024x1024x1024 cells, I fear that about 10^9 of such
unnecessary checks would be a waste of run time.
Is there a neat way of doing that? Like a 'static
constructor'?
tia,
- J.
to be created before any cells are accessed. Right now I have
a static method cell::create_lo okup_table() that does the job,
but I was wondering if there was some kind of a "static constructor"
that would do this automatically upon the construction of the
first cell instance? Sure I could make a normal constructor for
'cell' that would check a flag and create the look-up table if
it was not created already, but keeping in mind that I'd have
arrays of 1024x1024x1024 cells, I fear that about 10^9 of such
unnecessary checks would be a waste of run time.
Is there a neat way of doing that? Like a 'static
constructor'?
tia,
- J.
Comment