I solved the
problem, by specializing template for every type I believe it is a suitable
smart ptr:
template<class T>
struct is_smart_ptr :
boost::mpl::false_
{};
template<class T>
struct
is_smart_ptr<boost::shared_ptr<T> > :
boost::mpl::true_
{};
Sure
you need to modify the file etc. for every ptr like implementation, a more
general mechanism would be highly appreciated ;)
Best
Regards,
Ovanes
A while back there was discussion of detecting smart pointers.
The discussion started with Ovanes Markarian
Date: Thu, 22 Jun 2006
19:19:07 +0200 (CEST)
From: "Ovanes Markarian" < om_boost@keywallet.com>
Subject:
[Boost-users] inspecting templates and boost::is_pointer
To: boost-users@lists.boost.org
Message-ID:
<41230.194.138.18.132.115099674
7.squirrel@www.keywallet.com>
Content-Type:
text/plain;charset=iso-8859-1
Hello all,
I am trying to
specialize boost::is_pointer so, that it can determine if a type is a
pointer
wrapper (shared_ptr, auto_ptr, weak_ptr).
.....
And, first off, yes, we now know that expanding
is_pointer would be bad. So, instead we want 'is_pointer_like' or something like
that.
There were suggestions regarding detecting operator->() and/or
unary operator *().
What ever came of this? I am asking, of course,
because I could really use an 'is_pointer_like<>' or 'is_smart_ptr' right
now.
And if it is still unsolved, I've got 2 more
suggestions:
detecting that boost::get_pointer() (for boost::bind) has
been defined,
and/or
just looking for some common internals of the
smart_ptrs (hack!) - or adding some common internal typedef/value - ie
T::is_smart_pointer.
Thanks,
Tony