Opened 11 years ago

Last modified 8 years ago

#1107 new Feature Requests

Add weak_use_count to weak_ptr as a debugging aid

Reported by: Peter Dimov Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Severity: Optimization
Keywords: Cc: jwakely.boost@…

Description

http://lists.boost.org/Archives/boost/2006/03/102620.php

This is a feature request to add weak_use_count() to weak_ptr.

I am not interested in this feature for anything else than a debugging aid. Recently, a weakness was highlighted in one of my projects, I had stale weak_ptr objects that would remain in core even if all copies of weak and shared pointer objects should have been eliminated by now.

To confirm the bug fix and audit the rest of the code base, a debugger was used to set a conditional break point on internal members of weak_ptr. I would rather have the ability to write assertions when needed hence weak_use_count().

Attachments (1)

PATCH.weak_use_count.diff (20.0 KB) - added by Carsten Neumann <carsten_neumann@…> 6 years ago.
weak_use_count() implementation, docs, some testing coverage

Download all attachments as: .zip

Change History (6)

comment:1 Changed 11 years ago by Peter Dimov

Status: newassigned

comment:2 Changed 10 years ago by Peter Dimov

Milestone: To Be DeterminedBoost 1.37.0

comment:3 Changed 10 years ago by Peter Dimov

Milestone: Boost 1.37.0To Be Determined

comment:4 Changed 10 years ago by Jonathan Wakely <jwakely.boost@…>

Cc: jwakely.boost@… added

comment:5 Changed 8 years ago by Peter Dimov

Status: assignednew

Changed 6 years ago by Carsten Neumann <carsten_neumann@…>

Attachment: PATCH.weak_use_count.diff added

weak_use_count() implementation, docs, some testing coverage

Note: See TracTickets for help on using tickets.