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 construction, copy, move, and destruction events via a callback logger, while tracking copy, move, and shared active instance counts.
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.
Returns the current number of active instances sharing this tracked object.
Returns: Active instance count (0 if moved-from).
Destroys the LifetimeChecker and logs the destruction event.