fixup debugPtr

This commit is contained in:
Michael Davidsaver
2017-11-14 17:13:29 -06:00
parent 7136098c3c
commit 187fe67ffa
2 changed files with 8 additions and 0 deletions

View File

@@ -18,6 +18,8 @@ typedef epicsGuard<epicsMutex> Guard;
namespace epics {
namespace debug {
// joins together a group of ptr_base instances
// which all have the same dtor
struct tracker {
epicsMutex mutex;
ptr_base::ref_set_t refs;

View File

@@ -54,11 +54,13 @@ public:
void show_refs(std::ostream&, bool self=true, bool weak=false) const;
void spy_refs(ref_set_t&) const;
};
class epicsShareClass weak_ptr_base : public ptr_base {
protected:
weak_ptr_base() {}
weak_ptr_base(const track_t& track) :ptr_base(track) {}
};
class epicsShareClass shared_ptr_base : public ptr_base {
protected:
shared_ptr_base() noexcept
@@ -149,6 +151,10 @@ public:
template<typename A>
shared_ptr(const weak_ptr<A>& o) :shared_ptr_base(o.track), real(o.real) {track_new();}
// takeover from unique_ptr
template<typename A>
shared_ptr(std::unique_ptr<A>&& a) : shared_ptr_base(), real(a.release()) {track_new();}
~shared_ptr() {}
shared_ptr& operator=(const shared_ptr& o) {