When writing unit tests I often want to invoke a function with a combination of parameters. For example, I have a function which is declared as
void tester_func(int p1, double p2, std::string const& p3);
and some selected parameters
std::vector<int> vec_p1 = { 1, 2, 666 };
std::vector<double> vec_p2 = { 3.14159, 0.0001 };
std::vector<std::string> vec_p3 = { "Method_Smart", "Method_Silly" };
What I currently do is simply
for(auto const& p1 : vec_p1)
for(auto const& p2 : vec_p2)
for(auto const& p3 : vec_p3)
tester_func(p1, p2, p3);
However, Sean Parent suggests to avoid explicit loops and use std::
algorithms instead. How could one follow this advice in the above mentioned case? Any idioms? What is the cleanest way to write a variadic template that does this? What is the best way without C++11 features?