
AMDG On 11/02/2012 04:26 PM, Matt Calabrese wrote:
<snip>
// 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.
I haven't checked this, but it's the behavior that I would expect.
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).
You already have to specify this in the template argument list. I don't see how creating a dummy parameter makes it any worse.
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.
You have to define exactly what you mean by template aliases being equal. If you mean that for all template parameters, the aliases resolve to the same type, the problem is undecidable. (This follows directly from Rice's Theorem). In Christ, Steven Watanabe