/*
	 (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<int N>
struct fibonacci_term {
	static const int value = fibonacci_term<N-1>::value + fibonacci_term<N-2>::value;
};

template<>
struct fibonacci_term<1> {
	static const int value = 1;
};

template<>
struct fibonacci_term<0> {
	static const int value = 0;
};

} // end namespace my

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


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