Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-10-12 13:20:57


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<class ResultT, class ClassT, class ParamT>
        struct can_handle_message
        {
                template<ResultT (ClassT::*)(ParamT&)>
                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<ClassT*>(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


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