just like these code,In the template specialization defined the type,will be the type(at the label 1),the code test_two<N+1, Max, std::size_t>
continue to match the template specialization(struct test_two<N,Max,std::size_t>
) and caculate the type of test_two<N+1, Max, std::size_t>
and so on?
template<std::size_t N, std::size_t Max, typename T>
struct test_two
{
};
template<std::size_t N, std::size_t Max>
struct test_two<N,Max,std::size_t>
{
using type = test_two<N+1, Max, std::size_t> //label:1
};
As above
The declaration using type = test_two<N+1, Max, std::size_t>;
does not require the right-hand-side type to be complete, so it will not instantiate the definition of test_two<N+1, Max, std::size_t>
, only its declaration. There is therefore no infinite recursion.