Help with c++ template templates
问题 Ok, so I wrote an stl-like algorithm called cartesian_product . For those who don't know, the cartesian product is every possible pair of elements from two sets. So the cartesian product of {1, 2, 3} and {10, 20, 30} is {(1,10), (1,20), (1,30), (2,10), (2,20), (2,30), (3,10), (3,20), (3,30)} So the function looks like template <typename InIt1, typename InIt2, typename OutIt> void cartesian_product(InIt1 first1, InIt1 last1, InIt2 first2, InIt2 last2, OutIt out) { for (; first1 != last1; +