Boost logo

Boost Users :

Subject: Re: [Boost-users] [shared_ptr] Can the custom deleter be a simplefunction?
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-11-08 15:14:05


on Mon Nov 07 2011, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:

> Robert Jones wrote:
>> Thanks Gents - The phrasing of my question was hopelessly lax: I
>
>> appreciate in the
>> general case why one might choose to use a functor rather than a
>> function as a callable
>> object, what I didn't grasp (and there may be nothing to grasp), was
>> why this (from the
>> shared_ptr docs)
>>
>> struct null_deleter
>> {
>> void operator()(void const *) const
>> {
>> }
>> };
>>
>> Is implemented as a functor rather than a function.
>
> There's nothing to grasp. The only difference is that sizeof(
> null_deleter ) is 1,

...or effectively zero if EBO is leveraged.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net