Boost logo

Boost :

From: Stefan Slapeta (stefan_nospam__at_[hidden])
Date: 2004-07-09 12:40:41


Hi all,

this code sample produces a compiler error on VC 7.1. It seems that
boost::bind isn't able to get the right type for the specialization of
the member function template [&Test::g<Type1, Type2>].

Is there a good workaround? (The only one I could find so far is to
'hide' the function template as normal member function in a class template.)

Intel 8.0 compiles ok!

#include <boost/bind.hpp>
#include <boost/function.hpp>

class Test
{
public:
        template <typename Type1, typename Type2>
        void f(Type1 one, Type2 two)
        {
                boost::function<void (Type1, Type2)> bf =
                        boost::bind(&Test::g<Type1, Type2>, this,
                                        one, two);
        }

        template <typename Type1, typename Type2>
        void g(Type1, Type2)
        {
        }
};

int main() {
        Test t;
        t.f(0, 0);
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk