Boost logo

Boost Users :

From: Roman Perepelitsa (romka_at_[hidden])
Date: 2006-08-19 06:27:14


Matt Schuckmann <matt <at> schuckmannacres.com> writes:

>
> I can't seem to make boost::bind work with a member template function
> and it seems like is should.
>
> The following won't compile with MSVC 7.0,

Hi,

It's a bug in MSVC. You can try this workaround:

void ( Test_t::*f )( int, std::vector<long> & ) = &Test_t::testV<long>;
boost::bind( f, t, _1, v )(i);

Another options is to deduce type automatically:

struct Appender
{
        typedef void result_type;
        template <class T>
        void operator()( Test_t & t, int i, std::vector<T>& b ) const
        {
                t.testV( i, b );
        }
};

boost::bind( Appender(), t, _1, v )(i);

Roman Perepelitsa.


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