Opened 13 years ago
Closed 9 years ago
#3229 closed Feature Requests (wontfix)
boost::scoped_ptr second parameter with delete operations
| Reported by: | 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 , 13 years ago
| Milestone: | Boost 1.40.0 → To Be Determined |
|---|
comment:2 by , 9 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

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