C++ Template Metaprogramming
Solutions to the exercises throughout the book
|
Limit the max number of elements in the Fibonacci sequence. More...
Files | |
file | exercise-5-9.hpp |
Solution to Exercise 5-9. | |
Classes | |
struct | boost::mpl::next< exercise_5_8::fibonacci_series_iterator< 1134903170, 701408733 > > |
Establish an end (based on 32-bit signed int size). More... | |
struct | boost::mpl::prior< exercise_5_8::fibonacci_series_iterator< N, LastN > > |
Backward iteration is computable easily. More... | |
struct | boost::mpl::prior< exercise_5_8::fibonacci_series_iterator< 1, 1 > > |
Special case because we chose an irregular "begin" iterator value. More... | |
struct | boost::mpl::prior< exercise_5_8::fibonacci_series_iterator< 0, 1 > > |
Don't go before 0... More... | |
Functions | |
static void | anonymous_namespace{chapter-5.cpp}::print_fibonacci_series () |
Give us a nice subroutine to tie Fibonacci seq printout all together. | |
Limit the max number of elements in the Fibonacci sequence.
5-9. Modify the fibonacci_series sequence from exercise 5-8 to be limited by a maximum number of elements in the series. Make the sequence's iterators bidirectional: typedef fibonacci_series<8> seq; BOOST_STATIC_ASSERT( mpl::size<seq>::value == 8 ); BOOST_STATIC_ASSERT( mpl::back<seq>::type::value == 13 );
|
static |
Give us a nice subroutine to tie Fibonacci seq printout all together.
Definition at line 377 of file chapter-5.cpp.