If you use the name of a variable whose name is the same as the name of the loop variable, BOOST_FOREACH
gets confused:
#include <boost/foreach.hpp>
#include <vector>
struct Test { };
std::vector<int> test(Test) { return std::vector<int>(); }
Test c;
int main()
{
BOOST_FOREACH (int c, test(c))
{
}
}
I understand the cause of the problem, but I'm wondering, is this at all possible to fix?
I can't think of any way around it (that doesn't require virtual functions and such).