/*
	 (c) Divye Kapoor - 2008
	This code is distributed according to the terms of the BOOST software license.
	Distributed under the Boost Software License, Version 1.0.
	    (See accompanying file LICENSE_1_0.txt or copy at
	          http://www.boost.org/LICENSE_1_0.txt)
	
	See the accompanying blog entry at http://divyekapoor.blogspot.com
*/

#include <iostream>

//--------------------------------------------------------------------------
//  Begin useful code
namespace my {

template<long N>
struct factorial {
	static const long value = N*factorial<N-1>::value;
};

template<>
struct factorial<0> {
	static const long value = 1;
};

} // end namespace my

// End useful code
//----------------------------------------------------------------------------


int main() {
	std::cout << "The factorial of 10 is: " << my::factorial<10>::value;
	std::cout << "\nThe factorial of 0 is: " << my::factorial<0>::value << "\n";
	//std::cout << "\nThe factorial of -1 is: " << my::factorial<-1>::value  // gives an error
	
	return 0;
}
