16#include <boost/static_assert.hpp>
18#include <boost/mpl/at.hpp>
19#include <boost/mpl/begin_end.hpp>
20#include <boost/mpl/clear.hpp>
21#include <boost/mpl/insert.hpp>
22#include <boost/mpl/iterator_tags.hpp>
23#include <boost/mpl/minus.hpp>
24#include <boost/mpl/next_prior.hpp>
25#include <boost/mpl/plus.hpp>
26#include <boost/mpl/pop_back.hpp>
27#include <boost/mpl/pop_front.hpp>
28#include <boost/mpl/push_back.hpp>
29#include <boost/mpl/push_front.hpp>
30#include <boost/mpl/size.hpp>
32#include <boost/type_traits/is_same.hpp>
51template <
typename Tiny,
typename Pos>
55 typedef boost::mpl::random_access_iterator_tag
category;
62template <
typename T0 = none,
typename T1 = none,
typename T2 = none>
73template <
typename Tiny,
int Pos>
struct tiny_at { };
75template <
typename Tiny>
78 typedef typename Tiny::t0
type;
80template <
typename Tiny>
83 typedef typename Tiny::t1
type;
85template <
typename Tiny>
88 typedef typename Tiny::t2
type;
100template <
typename Tiny,
typename T,
int N>
103template <
typename Tiny,
typename T>
105template <
typename Tiny,
typename T>
107template <
typename Tiny,
typename T>
109 :
tiny<typename Tiny::t0, typename Tiny::t1, T> { };
111#ifndef PRE_EXERCISE_5_3
122template <
typename Tiny,
typename T,
int N>
125template <
typename Tiny,
typename T>
127 :
tiny<T, typename Tiny::t0, typename Tiny::t1>
129template <
typename Tiny,
typename T>
131 :
tiny<typename Tiny::t0, T, typename Tiny::t1>
133template <
typename Tiny,
typename T>
135 :
tiny<typename Tiny::t0, typename Tiny::t1, T>
140template <
typename T0,
typename T1,
typename T2>
143template <
typename T0,
typename T1>
145template <
typename T0>
162template <
typename Tiny,
typename Pos>
167 typename boost::mpl::next<Pos>::type
172template <
typename Tiny,
typename Pos>
177 typename boost::mpl::prior<Pos>::type
182template <
typename Tiny,
typename Pos,
typename N>
183struct advance<
chapter5::tiny_iterator<Tiny,Pos>, N >
187 typename boost::mpl::plus<Pos,N>::type
193template <
typename Tiny,
typename Pos>
194struct deref<
chapter5::tiny_iterator<Tiny,Pos> > : at<Tiny,Pos> { };
197template <
typename Tiny,
typename Pos1,
typename Pos2>
201 : boost::mpl::minus<Pos2, Pos1> { };
207 template <
typename Tiny,
typename N>
215 template <
typename Tiny>
226 template <
typename Tiny>
244 template <
typename Tiny>
259 template <
typename Tiny>
268 template <
typename Tiny,
typename T>
269#ifdef PRE_EXERCISE_5_3
271 : tiny_push_back<Tiny, T, size<Tiny>::value> { };
297 template <
typename Tiny,
typename T>
302 boost::is_same<typename Tiny::t2, chapter5::none>::value));
325 template <
typename Tiny,
typename Pos,
typename T>
328 template <
typename Tiny,
typename Pos,
typename T>
329 struct apply<Tiny,
chapter5::tiny_iterator<Tiny,Pos>, T>
360#include <boost/mpl/erase.hpp>
374template <
typename S,
int First,
int Last>
405 template <
typename S,
typename First,
typename Last>
409 template <
typename S,
typename First>
410 struct apply<S, First, mpl_::na >
411 : apply<S, First, typename boost::mpl::next<First>::type> { };
413 template <
typename S,
typename First,
typename Last>
424 template <
typename S>
426 : erase_impl<chapter5::tiny_tag>::template apply<
428 typename prior<typename end<S>::type>::type,
429 typename end<S>::type> { };
436 template <
typename S>
438 : erase_impl<chapter5::tiny_tag>::template apply<
440 typename begin<S>::type,
441 typename next<typename begin<S>::type>::type> { };
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::tiny_iterator< Tiny, typename boost::mpl::plus< Pos, N >::type > type
chapter5::tiny_iterator< Tiny, int_< 0 > > type
chapter5::tiny_iterator< Tiny, typename chapter5::tiny_size< typename Tiny::t0, typename Tiny::t1, typename Tiny::t2 >::type > type
chapter5::tiny_iterator< Tiny, typename boost::mpl::next< Pos >::type > type
chapter5::tiny_iterator< Tiny, typename boost::mpl::prior< Pos >::type > type
BOOST_STATIC_ASSERT((boost::is_same< typename Tiny::t2, chapter5::none >::value))
Quickly define a NULL type.
Provide O(1) access to sequences tagged with tiny_tag.
Erase a range of elements from a tiny sequence.
BOOST_STATIC_ASSERT((boost::is_same< typename Tiny::t2, none >::value))
BOOST_STATIC_ASSERT((boost::is_same< typename Tiny::t2, none >::value))
BOOST_STATIC_ASSERT((boost::is_same< typename Tiny::t2, none >::value))
Insert into the tiny sequence.
Define an iterator for use with the tiny sequence type.
boost::mpl::random_access_iterator_tag category
The tiny sequence has Random Access iteration semantics.
Add an element to the end of the tiny sequence.
Used to improve end metafunction performance, etc.
Type for tag-based implementation of algorithms below.
A small, random-access sequence type.