Assuming the error points somewhere deep inside Boost.ResultOf (as shown in this demo ), this would be because the closure type of the lambda expression does not implement the ResultOf protocol.
A somewhat simple workaround is to define BOOST_RESULT_OF_USE_DECLTYPE , which makes boost::result_of bypass its own ResultOf protocol, instead using decltype to evaluate return types. This is not enabled by default, because not many compilers (during the release of Boost 1.51) are compatible enough to make this function work; it is planned that this symbol will be determined automatically (by Boost.Config) for those compilers that can handle it in 1.52.
Here is a demonstration of how it looks like Boost.Phoenix with decltype -powered boost::result_of . I had to change int& to int const& , because i apparently being forwarded as const int . This seems to be the fundamental limitation of boost::phoenix::function , using boost::phoenix::val does not have this problem.
source share