Rob Caldecott ha escrito:
I am trying to test a template function that takes two template parameters, and, because of the "comma in macros" compiler issue, I have hit a brick wall. For example:
template<typename T1, typename T2> int func(const T1& t1, const T2& t2) { ... }
BOOST_CHECK_EQUAL(func<std::string, int>("Test", 1234), 1234);
When compiling BOOST_CHECK_EQUAL above, I get an error due to the comma between std::string and int. As this is a function, I cannot use typedef, and trying to #define a workaround also fails (I am using VS2005).
Any ideas how I can test template functions with more than one template parameter?
Try BOOST_CHECK_EQUAL((func<std::string, int>("Test" , 1234)), 1234); HTH, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo