[CTRL++] Reduce temporary objects

Every assignment of object and values to another object or value takes some time because it is a copy of the memory.

// Instead ofSomeClass mo1 = getSomeModelObject();AnotherClass mo2 = getAnotherModelObject();doSomething(mo1, mo2);// consider:doSomething(getSomeModelObject(), getAnotherModelObject());


For speed improvement it is recommended to avoid temporary objects if not needed later on again.

shared_ptr<ClassA> a = new ClassA();...a = nullptr; // if you do not need it anymore in the scope destroy...

Date added:
Last revised:
Rating: 4.1. 34 vote(s). No rating done at all.
Your vote was '' (0 of 5) Your are an anonymous user.
You may log on to do personalized votings
Click the rating bar to rate this item Please log on to do ratings
Programming / Scripting, OOP