| 1 |
|
|---|
| 2 | #include <boost/phoenix/core.hpp>
|
|---|
| 3 | #include <boost/phoenix/operator.hpp>
|
|---|
| 4 | #include <boost/range/adaptors.hpp>
|
|---|
| 5 |
|
|---|
| 6 | #include <iostream>
|
|---|
| 7 |
|
|---|
| 8 | int 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 |
|
|---|