Boost logo

Boost :

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2007-06-05 13:46:03


On Jun 5, 2007, at 12:42 PM, Emil Dotchevski wrote:

>
>> On Jun 4, 2007, at 10:57 PM, Emil Dotchevski wrote:> > One
>> important advantage of using boost::function is that it acts > >
>> like a> > function pointer, reducing physical coupling between
>> compilation > > units. This> > is very much like shared_ptr.> >> >
>> A nice feature of shared_ptr is that it has a single template > >
>> parameter, T,> > even though diferent instances of shared_ptr<T>
>> can use different> > allocators.> >> > When using boost::function,
>> one can also provide an allocator, but > > unlike> > shared_ptr,
>> the allocator is a default parameter of the > > boost::function> >
>> class template.> > > Is there a reason why this is necessary?
>> Can't boost::function use > > similar> > technique to the one
>> employed by shared_ptr to avoid the need for this> > second
>> template parameter?> > You know, I never even thought about adding
>> it. I didn't know about > the shared_ptr technique when I put the
>> allocator into > boost::function, and after the C++ committee
>> removed the allocator I > didn't think about it any more.
> Perhaps if the allocator it's moved to the constructor, the
> committee would accept it? :)

Since shared_ptr already has this functionality in its constructor,
they may accept it. You could certainly write a short proposal to the
C++ committee...

>> <snip>> I don't know when I would have time to implement this,
>> although I > would certainly consider adding this functionality to
>> Boost's > "function". Might you be interested in implementing it?
> OK, I'll give it a shot, and I'll let you know how it goes.

Great!

        - Doug


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