Andre Poenitz wrote:
On Thu, Aug 30, 2007 at 06:50:25PM +0200, Abdelrazak Younes wrote:
Andre Poenitz wrote:
On Thu, Aug 30, 2007 at 08:59:19AM +0200, Abdelrazak Younes wrote:
Andre Poenitz wrote:
I am tempted to commit the attached patch. Shaves ~22s off a release
build, i.e. roughly 1.2% of total time. Not exactly much, but a dozen of
such trivial changes will show...
Couldn't we just remove clone() and implement a copy operator instead?
The instantiation will happen anyway...
Not really. 'clone()' operates on base class pointers and returns a full
copy of the derived class object. Invoking a copy contructor would only
copy the 'base class slice' of the derived object.
Yes, I know that but I was thinking of passing the requesting InsetList
when doing the copy. An Inset has a unique identifier so with a big
switch you could instantiate the right class. This would also avoid the
factory thing.
While this might work I fail to see how the result can be simpler than
one line ( Inset * clone() const { return new InsetFoo(*this); } )
per class, and what we'd gain by this method.
Forget about it, just an idea.
You are basically arguing that we should not use virtual functions...
Of course not. I just wanted to simplify Inset creation that's all.
Abdel.