> I think that Jürgen is asking the question, "is it more expensive to assign
> PODs (your notation I think) or to construct them?" Well, if he isn't, I am!
Default-constructing a POD costs nada, they is no assignment at all.
There might be three ints on the stack in this case, but they
are "constructed" by changing the stackpointer in one operation.
[ Well... the two additional ints on the stack might cause a pagefault
and result in swapping or even crashing since you ran out of memory,
but hey ;-) ]
The argument of locality weights in _even_ if constructing an object does
cost something. In this case one _could_ divert from the rule if (and
only if) profiling shows that the "useless" construction is the bottleneck.
I have personnaly encountered this situation maybe four or five times in
the eight years or so that I am using C++, so I'd say it's pretty
improbable that this will happen in the table code ;-)
Otherwise rules like "keep scopes small", "don't use globals" make life
easier for everybody that tries to read the code later - including yourself.
Andre'
PS: Since we are at it: Default-constructing std::strings is pretty cheap, too.
--
Andre' Poenitz ........................................ [EMAIL PROTECTED]