14#include <boost/static_assert.hpp>
16#include <boost/mpl/greater.hpp>
17#include <boost/mpl/if.hpp>
18#include <boost/mpl/push_back.hpp>
20#include <boost/type_traits/is_same.hpp>
42 template <
typename S,
typename New>
44 : boost::mpl::eval_if<
45 boost::mpl::greater<S, New>,
46 chapter5::tree<S, New, void_>,
47 chapter5::tree<S, void_, New> >
52 template <
typename New,
typename Cur,
typename L,
typename R>
54 : boost::mpl::eval_if<
55 boost::mpl::greater<Cur, New>,
58 typename apply<L, New>::type,
63 typename apply<R, New>::type>
68 template <
typename New>
76 template <
typename New>
77 struct apply<void_, New>
90typedef boost::mpl::push_back<t1, boost::mpl::int_<5> >::type
t2;
91typedef boost::mpl::push_back<t2, boost::mpl::int_<3> >::type
t3;
92typedef boost::mpl::push_back<t3, boost::mpl::int_<7> >::type
t4;
93typedef boost::mpl::push_back<t4, boost::mpl::int_<1> >::type
t5;
Define a binary tree structure for future exercises.
BOOST_STATIC_ASSERT((boost::is_same< t5, expected_t5 >::value))
boost::mpl::push_back< t3, boost::mpl::int_< 7 > >::type t4
chapter5::tree< boost::mpl::int_< 5 >, chapter5::tree< boost::mpl::int_< 3 >, boost::mpl::int_< 1 >, void_ >, boost::mpl::int_< 7 > > expected_t5
boost::mpl::push_back< t2, boost::mpl::int_< 3 > >::type t3
boost::mpl::push_back< t1, boost::mpl::int_< 5 > >::type t2
boost::mpl::push_back< t4, boost::mpl::int_< 1 > >::type t5
Exists to inject functionality into the Boost MPL namespace.
Exists to inject functionality into the Boost namespace.
Provide utilities availble to all Chapter 5 solutions.
chapter5::tree< New > type
A basic type to represent a binary tree.