|
Boost : |
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-01-18 17:51:35
Hi,
I was wondering it is currently possible to give ptr_vector a custom
deleter? This could simply be in the form of a functor. If this feature does
not exist, would it be hard to add? For example, you could do this:
namespace boost
{
namespace detail
{
template< typename t_type >
struct default_deleter
{
void operator() ( t_type* ptr )
{
delete ptr;
}
};
}
template<
typename t_type,
typename t_deleter = detail::default_deleter<t_type>
>
class ptr_vector
{
private:
std::vector<t_type*> m_pointers;
public:
~ptr_vector()
{
std::for_each( m_pointers.begin(), m_pointers.end(), t_deleter()
);
}
};
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk