Opened 12 years ago

Closed 11 years ago

#4493 closed Feature Requests (fixed)

shared_array lacks get_deleter method

Reported by: Matthew Carter <r_q_einstein-boostbugs@…> Owned by: Peter Dimov
Milestone: Boost 1.44.0 Component: smart_ptr
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc: r_q_einstein-boostbugs@…

Description

shared_ptr has a get_deleter() method, which is very useful. shared_array does not have a get_deleter() method.

Since the deleter for a shared_array is passed to the constructor by value, there is no straightforward way* for the caller to get a pointer or reference to it. If the caller needs access to the deleter object's state or methods, which is entirely reasonable, the caller has no way to get it.

A get_deleter() method should be added to shared_array to meet this requirement and for consistency with the shared_ptr class.

*True, the caller can pass the deleter wrapped in a container object that holds a reference to the deleter, but that's a contortion that should not be necessary.

Change History (4)

comment:1 by Marshall Clow, 12 years ago

Component: arraysmart_ptr
Owner: changed from No-Maintainer to Peter Dimov

shared_array is part of the smart_ptr library, not Boost.Array.

comment:2 by Peter Dimov, 11 years ago

(In [75390]) Add get_deleter for shared_array. Refs #4493.

comment:3 by Peter Dimov, 11 years ago

Status: newassigned

comment:4 by Peter Dimov, 11 years ago

Resolution: fixed
Status: assignedclosed

(In [75754]) Merge [75390] to release. Fixes #4493.

Note: See TracTickets for help on using tickets.