I'm struggling to understand how deduction works in the following case:
template<class Category, Category code>
struct AImpl
{ };
template<class Category, Category code>
struct AHelper
{
using type = AImpl<Category, code>;
};
template<class Category, Category code>
using A = typename AHelper<Category, code>::type;
template<int code>
void doSomething(A<int, code> object)
{
}
Following is the test code:
A<int, 5> a1;
doSomething(a1); // This does not compile
doSomething<5>(a1); // This compiles
Why a1 is not deduced in this context?
If you modify A in the following way instead:
template<class Category, Category code>
struct A
{ };
Both work. Anyone knows why?
[edit] question linked to Mixing aliases and template specializations