clintbellanger/flare-engine — pull request #474 by josephbleau (2013-03-17 23:58:36+00:00)
Title: Dont create empty objects just to copy into an initializer list

Dont create empty objects just to copy into an initializer list, this costs us an extra creation, copy, and destruction, and in some instances can cause crashes when the constructed type expected to be worked on/initialized by another method before destructed.

Note, doing:

MyClass::MyClass() : someObject( someObjectsType() ) { ... }

Is the same as:

...
{
std::string myString( std::string() );
}

Which you would never do, just in this case it's less obvious that you're doing something wrong since it's in an initializer list and not inline with the declaration of the object.