Title
When is a deleter deleted?
Status
cd1
Section
[util.smartptr.getdeleter][tr.util.smartptr.shared.dest]
Submitter
Matt Austern

Created on 2006-01-10.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Add after the first sentence of [util.smartptr.getdeleter]/1:

The returned pointer remains valid as long as there exists a shared_ptr instance that owns d.

[Note: it is unspecified whether the pointer remains valid longer than that. This can happen if the implementation doesn't destroy the deleter until all weak_ptr instances in the ownership group are destroyed. -- end note]

Date: 2006-01-10.00:00:00

The description of ~shared_ptr doesn't say when the shared_ptr's deleter, if any, is destroyed. In principle there are two possibilities: it is destroyed unconditionally whenever ~shared_ptr is executed (which, from an implementation standpoint, means that the deleter is copied whenever the shared_ptr is copied), or it is destroyed immediately after the owned pointer is destroyed (which, from an implementation standpoint, means that the deleter object is shared between instances). We should say which it is.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3012
2006-01-10 00:00:00admincreate