Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2005-05-24 11:53:23


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
> Richard Hadsell
> Sent: Tuesday, May 24, 2005 7:00 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] Scoped_ptr + deleter
>
>
> Caleb Epstein wrote:
>
> >I'm not certain, but I would guess that overhead is the reason.
> >Perhaps someone more closely involved in the implementation (Peter?)
> >would care to comment.
> >
> >
> As a user of scoped_ptr and scoped_array, I expressed a
> strong opinion
> that its memory usage remain as is, and some Boost developers
> agreed.
> If you have a way to maintain the current behavior (speed and memory
> footprint) as a default, you are welcome to add functionality.
> Otherwise, it becomes useless to me.

What about something like:

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

template <class A>
struct caller
{
        static void callme(A * d)
        { delete d; }
};

template <class A,class caller>
struct l00lz
{
        A * p_;
        l00lz(A * p):p_(p)
        { caller::callme(p_); }
};

int main()
{
        int * a = new int(5);
        l00lz<int,caller<int> > b(a);
        return 0;
}

AFAIK, it wouldn't affect the speed nor memory footprint


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