Boost logo

Boost :

Subject: Re: [boost] shared_ptr/intrusive_ptr conflict
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-01-20 16:31:31


Am Wednesday 20 January 2010 19:59:11 schrieb Gennadiy Rozental:
> template <class T>
> boost::shared_ptr<T>
> get_concrete()
> {
> return boost::static_pointer_cast<T,void>(sharedPtr);
> }
>
> int main()
> {
> boost::shared_ptr<int> p = get_concrete<int>();
> }
> ----------------
>
> due to the presence of intrusive_ptr.hpp. it seems like SFINAE should have
> kicked in.
>
> Any help with how to work this around? Do we need to fix above header?

I'm not sure why that is, static_pointer_cast is an overload without any
SFINAE involvement that should still match to shared_ptr, but the workaround
is simple: remove the unnecessary "void" template argument in get_concrete.


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