Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-11-20 08:25:12


"Peter Dimov" <pdimov_at_[hidden]> writes:

> From: "David Abrahams" <dave_at_[hidden]>
>
> [get_deleter]
>
>> I think that considering the alternatives require:
>>
>> 1. Periodic map sweeps (we might as well be doing GC ;->), or
>>
>> 2. Solving the constructor forwarding problem for tacking on
>> additional data to the pointed-to class
>>
>> IMO it's worth giving serious consideration to deleter
>> introspection.
>
> Looks like I have to apply my mad "diligent reader" skills to the above.
>
  <snip>
>
> Correct?

Yep, you got mad skills.

> Now the interface questions.
>
> Q: Why a free function? A: a member would require the p.template
> get_deleter<D>() syntax when p is dependent on a template parameter.

That's one answer. There's also p.get_deleter(type<D>). Either one is
slightly ugly. But mostly I suggested a free function because it was
what came to mind.

> Q: Why use a generic 'get_deleter' name for the free function? A: ???

Heh. I suggest that it /not/ be intended for invocation via Koenig
Lookup, so the name would be OK.

There is another option, of course: make it a class template, like
boost::python::extract. Since introspection is a two-phase process
anyway, maybe that's better.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk