
Hi;
The program belows compiles and works but I'd like to simplify it, maybe
using MPL. I spent some fascinating time educating myself on MPL, reading
C++ Template Metaprogramming, but I am still at sea... to say the least.
Basically the Functor contains a switch statement that is not convenient
especially as the number of T classes will increase dramatically.
Many thanks for any help on that
JCR
#include <iostream>
#include <vector>
#include ::type);
// but it does not compile and MinGW returns:
// error: i cannot appear in a constant expression
// error: template argument 2 is invalid.
}
};
int main (int argc, char ** argv)
{
std::vector<int> runtimeVec;
runtimeVec.push_back(0);
runtimeVec.push_back(1);
runtimeVec.push_back(0);
std::for_each(runtimeVec.begin(), runtimeVec.end(), Functor());
std::cout << vec.size() << std::endl;
return 0;
}