CPP Game Dev ue
Limit the scope of specific operations
{ SCOPED_BOOT_TIMING("OnPostEngineInit.Broadcast"); FCoreDelegates::OnPostEngineInit.Broadcast(); }
This is particularly useful when using RAII (Resource Acquisition Is Initialization) principles, where creating an object acquires a resource (like starting a timer), and destroying the object releases the resource (like stopping the timer).
This is useful for measuring the time taken by specific blocks of code
By placing SCOPED_BOOT_TIMING
inside a set of brackets { ... }
, the macro object is limited to the scope defined by the brackets.
This is a typical design pattern in C++ when dealing with profiling or performance measurement, where you want the timing to be as precise as possible and tied to specific parts of your code.
When the scope ends (i.e., the code execution exits the brackets), the SCOPED_BOOT_TIMING
object is automatically destroyed, which would stop the timing.
Templates
Forward declaration is not enough for usage the class in the template header. It is easy to fix, you need just to include the target file with the class declaration, but it is not easy to detect.
The error I had was:
"Too few template arguments for class BSGameDataContainer<IBSGameDataType, typename>"
This same error you will see if the class you put into the container is not based of the base class.
So, the base problem of the template errors is their detection.