Basically what's happening is that T t = T() will resolve into an object of type T. This value can either be a default constructed object, or it can be supplied by you. When this is compiled it will compute the m_value.
Code:
template<class T, T t = T()>
Notice that this expression in this context is a default value.
We can figure it out by drilling down the examples.
Code:
A<int, -9>::m_value
//We have to substitute this: static const int m_value = B<(t > T())>::m_n - B<(t < T())>::m_n;
B<(-9 > 0)>::m_n - B<(-9 < 0)>::m_n
So what is B, and m_n, and what is m_value? Well, if we look:
Code:
template<bool b>
class B
{
public:
static const int m_n = b ? 1 : 0;
};
The template parameter is just a value we use. So we just substitute again.
Code:
B<(-9 > 0)>::m_n - B<(-9 < 0)>::m_n
B<false>::m_n - B<true>::m_n;
0 - 1
-1
m_value should be -1.
The others will be left for you to figure out.