WRT Unreal C++ is there any compile time or performance benefit to using initializer lists compared to initializing where declared?
Initalize when declared:
// declared and initialized in .h file
UPROPERTY(EditInstanceOnly)
class UStaticMeshComponent* _bodyComponent = nullptr;
// class body in .cpp file
AGenericGauge::AGenericGauge()
{
}
Initializer lists.
// declared in .h file
UPROPERTY(EditInstanceOnly)
class UStaticMeshComponent* _bodyComponent;
// initialized in .cpp file
AGenericGauge::AGenericGauge() :
_bodyComponent(nullptr)
{
}
Would be cool if anyone knows any info Epic has published about it. The first is nicer to maintain because all in one place. So is there a benefit to the other way?