Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-01-22 14:00:39


Noah,

I am aware of such constructs and possibilities. The problem arises if you
have the following class:

template<class T>
class ptr_like_type
{

public:
        T* operator->();
        //...
};
 

In this case you can not generically know thre result type of the operator->
(because it depends on specialization of type T) and therefore you can't say
if this function is defined or not. The only thing would be the use of
decltype or result_of operator. That is what I ment.

Best Regards,
Ovanes

-----Original Message-----
From: Noah Roberts [mailto:roberts.noah_at_[hidden]]
Sent: Monday, January 22, 2007 7:06 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] 'is_pointer_like' or 'is_smart_pointer'
orsimilar,again

Ovanes Markarian wrote:
> 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.

http://unitlib.svn.sourceforge.net/viewvc/unitlib/trunk/include/unitlib/meta
func/is_quantity_operand.hpp?revision=6&view=markup

A meta function that is composed of two meta functions that check for the
existence of a function with a particular signature in the passed in type
and for the existence of a typedef of a particular name. Uses SFINAE for
testing mechanics.

I don't know that this would help with the OP's problem except to make sure
there is a smart pointer that responds to a particular interface.
If that is what is needed then something like that would help.

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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