I'm a newbie for boost phoenix, I wrote a small piece of code but it totally confuses me about the execution sequence, you can check the code
std::vector<int> v;
v.push_back(1);
ph::for_each(v,
ph::lambda[ph::ref(cout)<<"a",
ph::ref(cout)<<"b"
])(v);
ph::for_each(arg1,
ph::lambda[ph::ref(cout)<<"a",
ph::for_each(v,
ph::lambda[ph::ref(cout)<<"b",
ph::ref(cout)<<"c"
]),
ph::ref(cout)<<"d"
])(v);
The first output is "ab" but the second output is "dbca"
Did I make some mistake?
The problem is the second ph::for_each, if I replace it with my own version for_each, it works from left to right. I compare my own version with official one, the difference is it use detail::begin and detail::end . But what's is real problem, I will continue to investigate it more .