Boost logo

Boost Users :

From: Matt Schuckmann (matt_at_[hidden])
Date: 2006-08-17 12:35:59


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,

struct Test_t
{
   template<typename T>
   void testV( int i, std::vector<T>& b )
   {
     b.push_back( static_cast<T>(i) );
   }

   char m_c;
};

void MyTest()
{
   int i(1);
   Test_t t;
   std::vector<long> v;

   boost::bind( &Test_t::testV<long>, t, _1, v )(i);
}

I get a whole bunch of wrong number of arguments errors.

I tried the boost::bind<void> variation and that also won't compile,
just with a little different error of the form
"cannot convert parameter 1 from 'void (int,std::vector<_Ty> &)' to
'boost::type<T>'"

If testV is just a regular template function, not a member of a class or
struct, it works fine.

Anybody have any idea how to make this work?

Thanks,
Matt S.


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