This question is just out of curiosity. In recursive templates if we forget to put one particular specialization, then compiler will do large number of iterations and then s
Should not be compiler smart enough to stop at some time ?
How do you define the phrase "at some time"? How would the compiler know your definition of "at some time"? How would it know when it must stop if you don't tell it explicitly? You've to tell it first by defining specialization(s) of the non-stopping class template (what you've written is non-stopping class template).
In your case, you must have two specializations of the class template, one in each directions (increasing, and decreasing). Something like this:
template<>
struct Infinite<100> //this is to stop template with argument
{
enum { value = 678678 }; //see, it doesn't use Infinite<> any further!
};
template<>
struct Infinite<-100> //this is to stop template with argument
{
enum { value = -67878 }; //see, it too doesn't use Infinite<> any further!
};