Welcome to the new CppUtils documentation!
CppUtils::UnitTest::LifetimeChecker
CLASSDiagnostic utility for tracking and validating object lifecycles in unit tests.
Description
Section titled “Description”Monitors default construction, copy, move, and destruction events via a callback logger, while maintaining thread-safe atomic counters for copy and move operations.
Public methods
Section titled “Public methods”LifetimeChecker::LifetimeChecker(std::function<void(std::string_view)> callback, std::string name, std::size_t indentationLevel = 0);Constructs a LifetimeChecker and logs object creation.
| Parameter | Description |
|---|---|
callback | Logging callback receiving string views of lifecycle events. |
name | Diagnostic identifier of the monitored object. |
indentationLevel | Tab indentation level for hierarchical visual logging. |
Returns the total number of copy constructions and copy assignments performed.
Returns: Cumulative copy operation count.
Returns the total number of move constructions and move assignments performed.
Returns: Cumulative move operation count.
Destroys the LifetimeChecker and logs the destruction event.