Boost logo

Boost Users :

Subject: [Boost-users] Boost.Function compile error
From: gast128 (gast128_at_[hidden])
Date: 2013-03-06 18:06:36


Dear all,

i got a compilation error with vstudio 2010 and Boost.Function:
1) pass functor in constructor
2) pass functor as assignment
3) use Boost.Ref
4) temporary function

void foo()
{
   std::identity<int> bla;

   boost::function<int (int)> fc(bla);
   boost::function<int (int)> fc2 = bla;
   boost::function<int (int)> fc(boost::ref(bla));
   boost::function<int (int)>(bla); //<--
}

first 3 are ok, but the last one vstudio sees this as redefintion of bla of type
'boost::function<int (int)>. What (and why) do I wrong or should use an explicit
cast in the last case?


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