Boost logo

Boost :

Subject: [boost] casting a shared_ptr from void with custom deleter
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2009-03-20 00:55:50


I'm trying to do something like this:

boost::shared_ptr<const Foo> fooPtr( boost::static_pointer_cast<const
Foo>(typeErasedFoo), CustomDeleter<const Foo>() );

where typeErasedFoo is of type:

boost::shared_ptr<const void>

The first statement compiles if I remove the custom deleter, but if I
leave it in, I get errors saying:

cannot convert parameter 2 from 'CustomDeleter<T>' to
'boost::detail::sp_enable_if_convertible_impl<true>::type'

Is there any way to do what I'm trying to do? I no longer need
typeErasedFoo after the cast if that helps.


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