|
C++ Template Metaprogramming
Solutions to the exercises throughout the book
|
"Compile-time STL." More...
Modules | |
| Exercise 5-0 | |
Exercise the parts of tiny we've implemented. | |
| Exercise 5-1 | |
Double the numbers in the first half of a RandomAccessSequence. | |
| Exercise 5-10 | |
| Write a tree structure with different view-based traversals. | |
| Exercise 5-2 | |
Make push_front as strict as push_back. | |
| Exercise 5-3 | |
Implement insert for tiny sequences. | |
| Exercise 5-4 | |
Reducing push_back template instantiations. | |
| Exercise 5-5 | |
| Add algorithms for tiny. | |
| Exercise 5-6 | |
| Present array dimensions as a numerical sequence. | |
| Exercise 5-7 | |
| Provide bi-directional iterators to Exercise 5-6. | |
| Exercise 5-8 | |
| Write Fibonacci sequences with Boost MPL's sequence APIs. | |
| Exercise 5-9 | |
| Limit the max number of elements in the Fibonacci sequence. | |
Files | |
| file | chapter-5-tiny.hpp |
Define a tiny sequence with modifications from examples in Chapter 5. | |
| file | chapter-5-tree.hpp |
| Define a binary tree structure for future exercises. | |
| file | chapter-5.cpp |
| Test application for Chapter 5. | |
Namespaces | |
| namespace | chapter5 |
| Provide utilities availble to all Chapter 5 solutions. | |
Classes | |
| struct | boost::mpl::next< chapter5::tiny_iterator< Tiny, Pos > > |
| Iterator next simply increments our numerical position info. More... | |
| struct | boost::mpl::prior< chapter5::tiny_iterator< Tiny, Pos > > |
| Iterator prior simply decrements our numerical position info. More... | |
| struct | boost::mpl::advance< chapter5::tiny_iterator< Tiny, Pos >, N > |
| Iterator advance is simple numerical addition. More... | |
| struct | boost::mpl::deref< chapter5::tiny_iterator< Tiny, Pos > > |
| Dereferencing the iterator is the first time we actually examine tiny. More... | |
| struct | boost::mpl::distance< chapter5::tiny_iterator< Tiny, Pos1 >, chapter5::tiny_iterator< Tiny, Pos2 > > |
| Our iterators deal in integers, so simply subtract the two. More... | |
| struct | boost::mpl::at_impl< chapter5::tiny_tag > |
| Forward to tiny_at for O(1) access. More... | |
| struct | boost::mpl::begin_impl< chapter5::tiny_tag > |
| Initialize the iterator with a position of 0. More... | |
| struct | boost::mpl::end_impl< chapter5::tiny_tag > |
| Finding the end requires tiny_size, which is O(1) complexity. More... | |
| struct | boost::mpl::size_impl< chapter5::tiny_tag > |
| Forward the MPL size lambda over to tiny_size. More... | |
| struct | boost::mpl::clear_impl< chapter5::tiny_tag > |
| Simply return a new, empty tiny sequence. More... | |
| struct | boost::mpl::push_back_impl< chapter5::tiny_tag > |
| If we can insert, use that, otherwise, use tiny_push_back. More... | |
"Compile-time STL."
C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond.
For exercises 5-2 through 5-5, see "chapter-5-tiny.hpp".