|
|
Wolfgang Wieser <wwi### [at] gmxde> wrote:
> They _are_ less efficient. (Because even temporaries trigger allocatation
> on the heap instead of the fast stack and because the con/destructors
> are called all the time increasing and decreasing reference counters,
> etc.)
How do using pointers directly alleviate the problem of temporaries
triggering allocation on the heap? I don't understand.
And constructors and destructors are called when instances are copied.
The most common place to copy an instance is when a function takes such
data container by value.
Usually you don't make functions which take big data containers by value,
but by reference, so no constructors/destructors are called.
> But _not_ for real simple types. For "I quickly need a vector", using
> double v[3] is still faster than anything using operator new or
> applying a fancy con/destructor.
But that's a *static* data type, not a dynamic one. Why would you
want to use a dynamic data container for a table of static size? That's
like shooting flies with a cannon.
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|