MCPcopy Create free account
hub / github.com/Naios/function2 / DeallocatorChecker

Class DeallocatorChecker

test/functionality-test.cpp:11–27  ·  view source on GitHub ↗

Increases the linked counter once for every destruction

Source from the content-addressed store, hash-verified

9namespace {
10/// Increases the linked counter once for every destruction
11class DeallocatorChecker {
12 std::shared_ptr<std::reference_wrapper<std::size_t>> checker_;
13
14public:
15 DeallocatorChecker(std::size_t& checker) {
16 checker_ = std::shared_ptr<std::reference_wrapper<std::size_t>>(
17 new std::reference_wrapper<std::size_t>(checker),
18 [=](std::reference_wrapper<std::size_t>* ptr) {
19 ++ptr->get();
20 std::default_delete<std::reference_wrapper<std::size_t>>{}(ptr);
21 });
22 }
23
24 std::size_t operator()() const {
25 return checker_->get();
26 }
27};
28
29struct VolatileProvider {
30 bool operator()() volatile {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected