|
Boost : |
Subject: Re: [boost] scoped_ptr deleter
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-09-22 15:10:26
Gottlob Frege wrote:
> On Tue, Sep 22, 2009 at 3:18 AM, Berserker <berserker_r_at_[hidden]> wrote:
>> What's the status about this? If we don't want to "break" the interface, we
>> can always provide an option to enable this feature, something like (same
>> for scoped_array):
>>
>> template<class T
>> #ifdef BOOST_SCOPED_PTR_ENABLE_DELETER
>> , class D = boost::checked_deleter<T> >
>> #endif
>> class scoped_ptr
>> {
>> // ...
>>
>> public:
>> ~scoped_ptr()
>> {
>> // ...
>>
>> #ifdef BOOST_SCOPED_PTR_ENABLE_DELETER
>> deleter()(ptr);
>> #else
>> boost::checked_delete(ptr);
>> #endif
>> }
>> };
>>
>> BOOST_SCOPED_PTR_ENABLE_DELETER is not defined by default.
>> There are lots of samples like this in other boost libraries, is it
>> reasonable?
>>
>
> No it is not reasonable (IMO). If I write new Boost library A using
> the deleter, and you write library B not using it, can anyone use
> *both* of our no doubt great and valuable libraries together in their
> code?
+1
IMO, the best solution is to develop a new pointer. std::unique_ptr
implementation would be a nice addition to boost.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk