
Hi Ovanes, as far as i understand is phoenix an officially released boost lib. It has been reviewed.See http://lambda-the-ultimate.org/node/3012 and http://www.boost.org/doc/libs/1_42_0/libs/spirit/phoenix/doc/html/index.html Cheers, Kim Ovanes Markarian schrieb:
On Tue, Mar 23, 2010 at 2:19 PM, Robert Jones
mailto:robertgbjones@gmail.com> wrote: Thanks Ovanes - I'm sure you will understand that my real code is a bit more complicated then doubling ints! Since both bind and lambda are pretty much superceded by phoenix now, perhaps you could also supply the phoenix version?
As far as I know boost::phoenix is not an officially released boost lib. It is still part of boost::spirit library. There is no top level reference to it. So I would not consider it for now to be a replacement for bind and lambda. It might become, but don't rely on that. ;) Anyway here the rewritten example:
#include
#include #include #include #include <algorithm> #include <vector> #include <iterator> #include <iostream>
using namespace std; using namespace boost; using namespace boost::phoenix; using namespace boost::phoenix::arg_names; using namespace boost::phoenix::local_names;
namespace ph = boost::phoenix;
int main( ) { vector< int > v; // generate vector values int i=0; generate_n(back_inserter(v), 100, ++ph::ref(i));
//create the output iterator ostream_iterator<int> oiter(cout, ","); copy(v.begin(), v.end(), oiter); cout << endl;
// double each value in the vector for_each(v.begin(), v.end(), arg1*=2); copy(v.begin(), v.end(), oiter); cout << endl; }
Regards, Ovanes ------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users