I always thought Boost.Phoenix used type-inference to infer everything statically, until I tried this code:
#include <vector>
#include <boost/phoenix/phoenix.hpp>
using namespace boost::phoenix;
using namespace boost::phoenix::placeholders;
struct Foo { int x; };
int main()
{
std::vector<int> bar;
bind(&Foo::x, ref(bar)[_1])("invalid index"); // oops
return 0;
}
and got the warning:
warning C4239: nonstandard extension used : 'argument' : conversion from
const char [3]
tovolatile const boost::proto::detail::anyns::any &
A non-const reference may only be bound to an lvalue
That surprised me. I didn't expect to see any
anywhere, much less volatile
!
Does that mean Boost.Phoenix is therefore actually inherently slower than its equivalent C++11 lambdas (ignoring the particular compiler I'm using here)?
volatile
though? – Yeomanry