Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-08-24 10:35:07


Vladimir Prus wrote:
>> Vladimir Prus wrote:
>>
>>> extern void (*function)();
>>> boost::shared_ptr<void ()> p2(function);
>>>
>>> return 0;
>>> }
>>>
>>> The first initialization, of course, work. The second produces a
>>> lots of errors. Do I miss something obvious?
>>
>> Just to clarify: my original intention is to use shared_ptr to a
>> function together with a custom deleter. I don't really think the
>> above could compile. But when I add:
>>
>> struct null_deleter
>> {
>> template<class T>
>> void operator()(T) const
>> {
>> }
>> };
>>
>> and change the code to be
>>
>> boost::shared_ptr<void ()> p2(function, null_deleter())
>>
>> I still get errors.
>>
>> The complete example with the custom deleter is attached.

Your example works for me on MSVC 7.1. What kinds of errors do you get, and
on what compilers?


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