Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-01-20 08:33:53


Just a small addition. You can also specialize the template in another file,
that is seen in the translation unit. But anyway you need to specialize it.
I hope with a new C++09 standard (it is still pretty far away), it will be
possible to inspect if a class has a specific member function (using typeof
or decltype operators). Currently it is only possible with has_xxx macros.
 
 
Best Regards,
Ovanes

  _____

From: Ovanes Markarian [mailto:om_boost_at_[hidden]]
Sent: Saturday, January 20, 2007 12:39 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] 'is_pointer_like' or 'is_smart_pointer'
orsimilar, again

Hi!

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

  _____

From: Gottlob Frege [mailto:gottlobfrege_at_[hidden]]
Sent: Friday, January 19, 2007 10:04 PM
To: boost-users_at_[hidden]
Subject: [Boost-users] 'is_pointer_like' or 'is_smart_pointer' or
similar,again

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_at_[hidden]
<mailto:om_boost_at_[hidden]> >
Subject: [Boost-users] inspecting templates and boost::is_pointer
To: boost-users_at_[hidden]
Message-ID:
        <41230.194.138.18.132.115099674

7.squirrel_at_[hidden]>
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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net