
On Sat, Apr 12, 2008 at 12:15 PM, JOAQUIN M. LOPEZ MUÑOZ <joaquin@tid.es> wrote:
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Mine is very similar to Joaquin one with one less indirection level. Default type here is assumed to be int, just to easy the test. template<typename T> struct each_type { typedef T type; }; template<> struct each_type<int> {}; // int is the default_type template<typename T, int n> struct unique_type : virtual each_type<T> {}; template<typename T1, typename T2, typename T3> struct test : unique_type<T1, 0>, unique_type<T2, 1>, unique_type<T3, 2> {}; template<> struct test<int, int, int> { typedef int type; }; testing is: int main(int, char**) { test<int, int, int>::type default_value = 0; test<int, char, int>::type char_value = 'x'; test<int, char, char>::type char_value_2 = 'y'; // test<int, char, double>::type error_value; compile error here! return 0; }