Boost logo

Boost Users :

From: Yan Drugalya (ydrugalya_at_[hidden])
Date: 2008-04-17 08:36:16


Folks,

What is wrong with the code below:

class SomeClass
{
public:
   int doSomething(int i=0)
   {
      return ++i;
   }
};

boost::function2<int, SomeClass*, int> func = &SomeClass::doSomething;
SomeClass sc;
std::cout << func(&sc, 1);

Currently I'm having following error:

An object or reference of type "boost::function2<int,SomeClass
*,int,std::allocat
or<boost::function_base> >" cannot be initialized with an rvalue of type
"int
(SomeClass::*)(int)".

If I remove default value for parameter i - everything compiles. Complier:
VisualAge 7.0

Thanks



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