
In working on Boost.Generic I need, in multiple parts of the library, to detect if two template aliases are equivalent. For instance, this is required when comparing the compatibility of an automatically generated concept map of a less-refined concept with an explicitly created concept map for the less-refined concept when the concept in question has an associated class template. This seems like it shouldn't be too difficult, but apparently my understanding of template aliases is incomplete: //////////////////// // Create a template template< class > struct template_ {}; // Make a simple alias of the template template< class A > using template_alias = template_< A >; // Create a metafunction to determine if two unary type templates are the same template< template< class > class L, template< class > class R > struct templates_are_the_same { static bool constexpr value = false; }; template< template< class > class T > struct templates_are_the_same< T, T > { static bool constexpr value = true; }; // In Clang and GCC, the following static_assert will be triggered static_assert( templates_are_the_same< template_, template_alias >::value , "Templates are not the same." ); //////////////////// This behavior is observed in both Clang and GCC, though I haven't verified that it is correct behavior in the standard. Assuming that it is in fact standard, can anyone conceive of a way around this limitation? I've considered passing dummy arguments to the templates based on the template parameter list and checking that the resultant types are equal, but I'd like to avoid that if at all possible, since it seems like it would be difficult or impossible to support certain templates properly (I.E. consider the template parameter list of a template where one parameter type is dependent on another, like std::integral_constant). This type of detection is very important in making Boost.Generic work as closely to N2914 as possible so any workaround, however hairy, would be a huge help. -- -Matt Calabrese