diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-18 12:46:41 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-18 12:46:41 +0100 |
| commit | e1968cda0acae4d3236181cea7c5a35ebb3dfcc6 (patch) | |
| tree | 6ab086c9cd345f18456905d427a44524d415c4e5 /examples | |
| parent | c44d6912bc2f37e8d1c239cfb9981bd5cd366c58 (diff) | |
feat: better tracked_ptr example.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/tracked_ptr/tracked_ptr.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/tracked_ptr/tracked_ptr.cc b/examples/tracked_ptr/tracked_ptr.cc index be88d17..f99bd97 100644 --- a/examples/tracked_ptr/tracked_ptr.cc +++ b/examples/tracked_ptr/tracked_ptr.cc @@ -9,7 +9,8 @@ void foo() { - snu::memory::tracked_ptr<int> ptr9; + snu::memory::tracked_ptr<int> ptr; + std::cout << ptr.data() << "=" << ptr.manager().allocator().allocated_count_ << std::endl; } /* finally test it */ @@ -22,8 +23,8 @@ int main(int argc, char** argv) snu::memory::tracked_ptr<int> ptr; - std::cout << ptr.manager().allocator().allocated_count_ << std::endl; - std::cout << ptr.manager().allocator().deallocated_count_ << std::endl; + std::cout << ptr.data() << "=" << ptr.manager().allocator().allocated_count_ << std::endl; + std::cout << "total=" << ptr.manager().allocator().deallocated_count_ << std::endl; return 0; } |
