|
Boost : |
From: jkharris01 (john.harris_at_[hidden])
Date: 2002-01-16 10:39:41
This code doesn't compile with MSVC6 and boost 1.26.0 unless I change
the member function return type to something other than void. The
RHS is fine, but trying to save it off in a boost::function<...> is
not. What's up?
struct X
{
virtual void foo(int) {}
}the_x;
int main(int argc, char* argv[])
{
boost::function<void,int> f = boost::bind(&X::foo, &the_x, _1);
======= error message
d:\work\misc\boost\1_26_0\dev\boost/bind/mem_fn_template.hpp(100) :
error C2562: '()' : 'void' function returning a value
d:\work\misc\boost\1_26_0\dev\boost/bind/mem_fn_template.hpp
(98) : see declaration of '()'
d:\work\misc\boost\1_26_0\dev\boost/bind/mem_fn_template.hpp
(99) : while compiling class-template member function 'void
__thiscall boost::_mfi::mf1<void,struct X,int>::operator ()(struct X
*,int) const'
========== code referenced by error message:
// mf1
template<class R, class T, class A1> class BOOST_MEM_FN_NAME(mf1)
{
public:
typedef R result_type;
typedef T * first_argument_type;
typedef A1 second_argument_type;
private:
typedef R (BOOST_MEM_FN_CC T::*F) (A1);
F f_;
public:
explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {}
R operator()(T * p, A1 a1) const
{
===>error line!!! BOOST_MEM_FN_RETURN (p->*f_)(a1);
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk