24 Jun
2006
24 Jun
'06
2:56 a.m.
"Ovanes Markarian"
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). -- Dave Abrahams Boost Consulting www.boost-consulting.com