
4 May
2011
4 May
'11
7:27 p.m.
On 04/05/2011 20:43, lcaminiti wrote:
Can I do this without auto?
Not if you want to define the function object in a local scope.
Otherwise, the local Phoenix function retains its polymorphic behavior only on C++0x (but not on ISO C++)
Note a lot of C++03 compilers provide typeof which is basically the same thing, and it can be implemented on MSVC exploiting a bug. So you can write BOOST_AUTO(f, ref(sum) += factor * _1); and it's pretty portable. Actually, Boost.Phoenix uses Proto, which itself requires native support of Boost.Typeof.