]>
git.saurik.com Git - apple/xnu.git/blob - tests/intrusive_shared_ptr_src/detach.cpp
3 // pointer detach() noexcept;
6 #include <libkern/c++/intrusive_shared_ptr.h>
7 #include <darwintest.h>
8 #include "test_policy.h"
20 tracking_policy::reset();
21 tracked_shared_ptr
<T
> ptr(&obj
, libkern::retain
);
22 T
* raw
= ptr
.detach();
24 CHECK(ptr
.get() == nullptr); // ptr was set to null
25 CHECK(tracking_policy::retains
== 1);
26 CHECK(tracking_policy::releases
== 0);
29 T_DECL(detach
, "intrusive_shared_ptr.detach") {