Ticket #10632: transform_pb.cpp

File transform_pb.cpp, 607 bytes (added by Fabien Nendaz <fabien@…>, 8 years ago)

Minimal program to reproduce

Line 
1
2#include <boost/phoenix/core.hpp>
3#include <boost/phoenix/operator.hpp>
4#include <boost/range/adaptors.hpp>
5
6#include <iostream>
7
8int main(int,char**)
9{
10 using boost::adaptors::transformed;
11 using boost::phoenix::arg_names::arg1;
12
13 const int n = 10;
14 std::vector<float> initialVec( n );
15 for ( int i = 1; i < n; ++i ) initialVec[i] = i;
16
17 for( auto f : initialVec ) std::cout << f << " ";
18 std::cout << std::endl;
19
20 auto testVec = initialVec | transformed( arg1 * 2 ) | transformed( arg1 );
21 for( auto f : testVec ) std::cout << f << " ";
22 std::cout << std::endl;
23
24 return 0;
25}
26