From: David Abrahams <dave@boost-consulting.com >
 

"Ovanes Markarian" < om_boost@keywallet.com> 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