To date, much of Jag has been coded by passes shared_ptr variables as
parameters, rather than references to shared_ptrs. An example would be
jagSG::Node::addChild:
void addChild( NodePtr node );
which should be:
void addChild( NodePtr& node );
Passing by reference avoids an unnecessary invocation of the shared_ptr copy
constructor and is therefore more efficient.
This change should be made universally throughout the existing Jag code base,
and references should be used (as a general rule) moving forward.
Need to check: Will a reference work in the base class case? For example,
imagine class B derives from class A. Will this code work?
void myFunc( shared_ptr<A>& aParam );
shared_ptr<B> bVar;
myFunc( bVar );
That is, can we use:
void myFunc( shared_ptr<A>& aParam );
or do we have to use:
void myFunc( shared_ptr<A> aParam );
Need to test and make sure the reference will work OK.
Original issue reported on code.google.com by SkewMat...@gmail.com on 19 Jul 2013 at 6:12
Original issue reported on code.google.com by
SkewMat...@gmail.com
on 19 Jul 2013 at 6:12