
6 Mar
2013
6 Mar
'13
11:34 p.m.
AMDG On 03/06/2013 03:06 PM, gast128 wrote:
<snip>
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?
The last line is treated the same as: boost::function<int(int)> bla; You can get around this by using it in a larger expression or just by wrapping it in parentheses, to prevent it from being parsed as a declaration. i.e. (boost::function<int (int)>(bla)); In Christ, Steven Watanabe