Ticket #5683: phoenix_problem2.cpp

File phoenix_problem2.cpp, 768 bytes (added by Thomas Heller, 11 years ago)

testcase showing that problem

Line 
1
2#include <boost/phoenix.hpp>
3
4#include <vector>
5
6int main()
7{
8 namespace phx = boost::phoenix;
9 using namespace phx::arg_names;
10 using phx::ref;
11 using phx::begin;
12 using phx::lambda;
13 using phx::nothing;
14
15 int data[] = {2,4,6,8,10};
16 std::vector<int> veca(data, data+5);
17 std::vector<int> vecb(veca.size());
18 double a,b,c,d,e,f,g,h,i,j;
19
20 //Works fine
21 phx::transform(ref(veca), begin(ref(vecb)), lambda[arg1+1])
22 (a,b,c,d,e,f,g,h,i,j);
23 //
24 // //Works fine
25 int acc = phx::accumulate(ref(veca), phx::construct<int>())
26 (a,b,c,d,e,f,g,h,i,j);
27 //
28 // //Doesn't compile
29 phx::for_each(ref(veca), lambda[arg1+1])
30 (a, b, c) /*works if you change to 0,1 or 2 arguments*/;
31}