|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-01-20 16:08:00
"Jonathan Turkanis" <technews_at_[hidden]> wrote in message
news:bujrvl$shb$1_at_sea.gmane.org...
> "Bronek Kozicki" <brok_at_[hidden]> wrote in message
> Jonathan Turkanis <technews_at_[hidden]> wrote:
>
> Here's a funny solution -- the stored deleter is a pointer into a
huge
> static array:
>
> typedef void (*deleter_fn) (void*);
>
> struct deleter {
> deleter_fn deleter;
> int offset;
> };
>
> template<typename D, typename T>
> struct deleter_holder {
> typedef deleter (&deleter_array) [SHRT_MAX];
> static deleter_array deleters()
> {
> deleter ar[SHRT_MAX];
> // Initialize on first use, with all possible
offsets
> in range -SHRT_MAX/2 to SHRT_MAX/2.
> return ar;
> }
> static void destroy(void* pv) { D()((T*) pv); }
> };
This was a joke, obviously, but it's given me several ideas which just
might work. I'll write them up RSN.
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk