Unbenanntes Dokument
https://portal.etm.at/index.php?=ivy-league-essay-help/
phd creative writing sheffield | Register
-->
Home ETM FAQ Tips & Tricks [CTRL++] Reduce temporary objects

Email Print

[CTRL++] Reduce temporary objects

Date added:
Wednesday, 23 May 2018
Last revised:
Wednesday, 30 May 2018
Hits:
482
Rating:
 
Vote for this:
Good - Bad

Answer

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

// Instead of
SomeClass 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
...

Keywords for this item

Keywords

1 items are tagged with 3.12   1 items are tagged with 3.13   1 items are tagged with 3.14   1 items are tagged with 3.15   1 items are tagged with ALL Versions   1 items are tagged with Engineering   1 items are tagged with Installation / Configuration   4 items are tagged with OOP   6 items are tagged with Programming / Scripting   1 items are tagged with PVSS   2 items are tagged with WinCC Open Architecture   1 items are tagged with Windows  

Search FAQ


            Forgot login? | Register