C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
exercise-5-10.hpp File Reference

Solution to Exercise 5-10. More...

#include "chapter-5-tree.hpp"
#include <boost/static_assert.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/greater.hpp>
#include <boost/mpl/iterator_tags.hpp>
#include <boost/mpl/next_prior.hpp>
#include <boost/type_traits/is_same.hpp>

Go to the source code of this file.

Classes

struct  exercise_5_10::inorder_view_tag
 A tag for tag-dispatched sequence metafunctions. More...
 
struct  exercise_5_10::inorder_view< T >
 Compels iterators to traverse the tree "in order". More...
 
struct  exercise_5_10::inorder_view_iterator< Cur, Parent, VisitCount >
 Establish an iterator to contain in-order traversal of the binary tree. More...
 
struct  boost::mpl::end_impl< exercise_5_10::inorder_view_tag >
 Simply returns inorder_view_iterator_end. More...
 
struct  boost::mpl::end_impl< exercise_5_10::inorder_view_tag >::apply
 
struct  boost::mpl::begin_impl< exercise_5_10::inorder_view_tag >
 The begin algorithm needs to traverse to the leftmost element, creating iterators along the way. More...
 
struct  boost::mpl::begin_impl< exercise_5_10::inorder_view_tag >::apply_on_iterator
 For the leaf, we've reached the beginning. Set visit count to 1. More...
 
struct  boost::mpl::begin_impl< exercise_5_10::inorder_view_tag >::apply_on_iterator< chapter5::tree< Cur, L, R >, Parent >
 For every subtree, set the visit count to 1. More...
 
struct  boost::mpl::begin_impl< exercise_5_10::inorder_view_tag >::apply_on_iterator< chapter5::tree<>, Parent >
 With an empty tree, begin == end. More...
 
struct  boost::mpl::begin_impl< exercise_5_10::inorder_view_tag >::apply
 Start here. The root's parent is also the end of the sequence. More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< Cur, Parent, VisitCount > >
 In-order traversal. More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< Cur, Parent, 0 > >
 Visiting a leaf for the first time: present it as the "next" item. More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, L, R >, Parent, VisitCount > >
 This is an error – Visit count must not be [0,3]. More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, L, R >, Parent, 0 > >
 We've never visited this item, so we should start by going left. More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, void_, R >, Parent, 0 > >
 Same as above, but L node is empty, so go back up... More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, L, R >, Parent, 1 > >
 Seen this node once, so we should present it as the "next" item. More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, L, R >, Parent, 2 > >
 Visited this node twice already, so the only place to go is right. More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, L, void_ >, Parent, 2 > >
 Same as above, but R node is empty, so go back up... More...
 
struct  boost::mpl::next< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, L, R >, Parent, 3 > >
 Go back up the tree. If we reach "end" as the parent, we've fully traversed the tree. More...
 
struct  boost::mpl::deref< exercise_5_10::inorder_view_iterator< Cur, Parent, VisitCount > >
 This specialization is only for leaf nodes. Grab it directly from the iterator. More...
 
struct  boost::mpl::deref< exercise_5_10::inorder_view_iterator< chapter5::tree< Cur, L, R >, Parent, VisitCount > >
 Grab the first value from the subtree contained in the iterator. More...
 

Namespaces

namespace  exercise_5_10
 Encapsulate solution for Exercise 5-10.
 
namespace  boost
 Exists to inject functionality into the Boost namespace.
 
namespace  boost::mpl
 Exists to inject functionality into the Boost MPL namespace.
 

Typedefs

typedef inorder_view_iterator< void_, void_, 0 > exercise_5_10::inorder_view_iterator_end
 Establish an end to the sequence.
 

Detailed Description

Solution to Exercise 5-10.

Author
Matt Bisson

Definition in file exercise-5-10.hpp.