v16
-
.IN_SEQUENCE(...)can now be used withREQUIRE_DESTRUCTION(...)
andNAMED_REQUIRE_DESTRUCTION(...)to ensure objects are destroyed in the intended order.
Example:auto p1 = new trompeloeil::deathwatched<mock1>; auto p2 = new trompeloeil::deathwatched<mock2>; trompeloeil::sequence s; REQUIRE_DESTRUCTION(*p1) .IN_SEQUENCE(s); REQUIRE_DESTRUCTION(*p2) .IN_SEQUENCE(s); call_destroyer(p1, p2); // both must be destroyed, p1 before p2.
-
class
trompeloeil::lifetime_monitornow inherits from classtrompeloeil::expectation, so usingstd::unique_ptr<expectation> p = NAMED_REQUIRE_DESTRUCTION(obj);
instead of
std::unique_ptr<lifetime_monitor> p = NAMED_REQUIRE_DESTRUCTION(obj);
works equally well, reduces the cognitive load a bit, and seems to build slightly faster.