Forget my first post, I was getting confused between your case and the
choice between alternate partial template specialisations. Since you only
have one partial template specialisation, it will be used if it is matched.
Your example is clever because it confuses two different processes. My take
on it is this. By saying
template< class a, class b, class c = int > something ...
in the primary template you are saying that whenever the template something
appears with two arguments a third int argument is added. I.e.
something<int, int> a; is equivalent to something <int, int, int> a;
and also that
template< class a, class b >
struct something<a, b>
{
};
is equivalent to
template< class a, class b >
struct something<a, b, int>
{
};
Once we see that, it obvious whether the specialisation applies or not. If
the third template argument is an int (explicitly or implicitly), use the
specialisation. I.e.
something<int, int> a; // implicit int, use specialisation
something<int, int, int> b; // explicit int, use specialisation
something<int, int, double> c; // not an int, use primary
john