Here, is my code. Just trying to wrap my head around some of the basic things you can do with TMP. I'm trying to supply two numbers with which the compiler will add up that range of numbers. I'm just not sure how to write the syntax for the "constraint" template.
template < int b, int e >
struct add {
enum { sum = add< b + 1, e >::sum + b };
};
template <>
struct add< e, e > {
enum { sum = 0 };
};
int main() {
cout << add< 4, 8 >::sum << endl; //30
return 0;
}