Opened 13 years ago

Closed 9 years ago

#3229 closed Feature Requests (wontfix)

boost::scoped_ptr second parameter with delete operations

Reported by: Stepan Koltsov <yozh@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.39.0 Severity: Not Applicable
Keywords: Cc:

Description

Requesting second parameter of scoped_ptr (and other smart pointers) templates, specifying destroy operation for pointer. Something like this (simplified code):

template <class T>
struct destroy_delete {
  static void destroy(T* t) { delete t; }
};

template <class T, class D = destroy_delete>
class scoped_ptr {
  ~scoped_ptr() {
    D::destroy(px);
  }
};


// this I can use in my code
template <class T>
struct destroy_free {
  static void destroy(T* t) { free(t); }
};

Change History (2)

comment:1 by Peter Dimov, 13 years ago

Milestone: Boost 1.40.0To Be Determined

comment:2 by Peter Dimov, 9 years ago

Resolution: wontfix
Status: newclosed

std::unique_ptr is the recommended alternative when you need a deleter.

Note: See TracTickets for help on using tickets.