[Interest] initialising a dictionary-type container instance with a static table?
kshegunov at gmail.com
Mon Jan 2 15:20:16 CET 2017
On Mon, Jan 2, 2017 at 4:15 PM, René J. V. Bertin <rjvbertin at gmail.com>
> > Note that all of this is constructed at *load* time, not at compile time
> > not on first use.
> so it doesn't work like a classical static variable which is initialised
> once, presuming you meant to say "not on first use *only*"?
It works exactly as a classic static variable with *nontrivial*
initialization. It's initialized only once before entering main().
This is in contrast with (e.g. heap allocated objects) that can be
initialized only and if used - "on first use".
> You already have a perfect hash in the case of a set of unique keys, like
> enum, no?
Depends on the hashing function, but in the general case, no you don't.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest