Hello!
I have a problem with g++ 3.2.3 which has a bug for SFINAE.
In my code I am trying to find out if some certain message handler is implemented or not (I know
that I could do it via virtual function, but I would like to try doing it first without).
The solution for that kind of meta-program is well known and can be represented as the following
class:
template
struct can_handle_message
{
template
struct wrapper;
template<typename U>
static char(&test(U*, wrapper<&U::handleMessage>* w=0))[1];
static char(&test(...))[2];
typedef boost::mpl::bool_<1==sizeof(test(static_cast(NULL)))> result;
};
g++ 3.4.3 compiles it fine, but g++ 3.2.3 fails.
Somewhere in the newsgroups I read that g++ 3.2.3 needs a complete type as workaround to compile.
Since the function I am looking for is parameterized I can not provide a complete type. Is there
any boost analog which can help me in any way?
Many thanks!
With Kind Regards,
Ovanes Markarian