Boost logo

Boost Users :

From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2006-06-27 13:24:38


>
> From: David Abrahams <dave_at_[hidden]>

"Ovanes Markarian" <om_boost_at_[hidden]> writes:
>
> > Does anyone know if it possible to determine if a class
> > overloads a certain function _where_ the return type is unknown.
> >
> > An example is the -> operator. It can return any type. My question
> > is: is it possible to determine at compile time if some type
> > overloads the -> operator, without knowing the return type when this
> > operator is overloaded?
>
> That would only be possible if -> could be a free function, but IIRC
> it is required to be a member function... so the answer is no.
>
> You can do it for any function that can be implemented as a non-member
> (see e.g. boost/detail/is_incrementable.hpp).
>
>
Also, if your end goal is still something like is_pointer_like<T>, instead
of detecting operator->, you might be able to use the same techniques as
is_incrementable to detect operator * (unary) - ie implement
is_dereferenceable<T>.

Would it be OK to assume is_pointer_like<T> '==' is_dereferenceable<T> ?

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