10#ifndef CHAPTER_7_ZIP_VIEW
11#define CHAPTER_7_ZIP_VIEW
13#include <boost/mpl/begin_end.hpp>
14#include <boost/mpl/deref.hpp>
15#include <boost/mpl/iterator_category.hpp>
16#include <boost/mpl/iterator_range.hpp>
17#include <boost/mpl/placeholders.hpp>
18#include <boost/mpl/transform.hpp>
19using namespace boost::mpl::placeholders;
22#ifndef FORWARD_ONLY_ZIP_VIEW
24#include <boost/mpl/empty.hpp>
25#include <boost/mpl/find_if.hpp>
26#include <boost/mpl/filter_view.hpp>
28#include <boost/type_traits/is_same.hpp>
44 typedef typename boost::mpl::begin<S>::type::category
type;
66 typedef typename boost::mpl::filter_view<
71 boost::mpl::random_access_iterator_tag>
77 typedef typename boost::mpl::filter_view<
82 boost::mpl::bidirectional_iterator_tag>
86 typedef typename boost::mpl::if_<
87 boost::mpl::empty<non_random_access_iterators>,
88 boost::mpl::random_access_iterator_tag,
89 typename boost::mpl::if_<
90 boost::mpl::empty<non_bidirectional_iterators>,
91 boost::mpl::bidirectional_iterator_tag,
92 boost::mpl::forward_iterator_tag>
::type
102 typedef boost::mpl::forward_iterator_tag
type;
108template <
typename IteratorSeq,
typename Category>
110 : boost::mpl::transform< IteratorSeq, boost::mpl::deref<_1> >
124template <
typename Sequences>
126 : boost::mpl::iterator_range<
128 typename boost::mpl::transform<
129 Sequences, boost::mpl::begin<_1>
131 typename least_refined_iterator_category<Sequences>::type
134 typename boost::mpl::transform<
135 Sequences, boost::mpl::end<_1>
137 typename least_refined_iterator_category<Sequences>::type
147#include <boost/static_assert.hpp>
148#include <boost/mpl/or.hpp>
150#include <boost/mpl/at.hpp>
160template <
typename IteratorSeq,
typename Category>
161struct next<
chapter7::zip_iterator<IteratorSeq, Category> >
164 typename transform< IteratorSeq, next<_1> >::type,
177template <
typename IteratorSeq,
typename N>
179 chapter7::zip_iterator<IteratorSeq, random_access_iterator_tag>, N >
182 typename transform< IteratorSeq, advance<_1, N> >::type,
183 random_access_iterator_tag
196 template <
typename S,
typename Category,
typename N>
struct apply_impl { };
198 template <
typename S,
typename N>
199 struct apply_impl<S, random_access_iterator_tag, N>
202 typename transform< S, at<_1, N> >::type,
203 random_access_iterator_tag>
type;
206 template <
typename S,
typename N>
struct apply { };
207 template <
typename S,
typename N>
211 typename chapter7::least_refined_iterator_category<S>::type,
217template <
typename IteratorSeq,
typename Category>
218struct prior<
chapter7::zip_iterator<IteratorSeq, Category> >
224 boost::mpl::bidirectional_iterator_tag>,
227 boost::mpl::random_access_iterator_tag>
231 typename transform< IteratorSeq, prior<_1> >::type,
Exists to inject functionality into the Boost MPL namespace.
Exists to inject functionality into the Boost namespace.
Provide utilities availble to all Chapter 7 solutions.
chapter7::zip_iterator< typename transform< IteratorSeq, advance< _1, N > >::type, random_access_iterator_tag > type
chapter7::zip_iterator< typename transform< S, at< _1, N > >::type, random_access_iterator_tag > type
chapter7::zip_iterator< typename transform< IteratorSeq, next< _1 > >::type, Category > type
chapter7::zip_iterator< typename transform< IteratorSeq, prior< _1 > >::type, Category > type
BOOST_STATIC_ASSERT((boost::mpl::or_< boost::is_same< Category, boost::mpl::bidirectional_iterator_tag >, boost::is_same< Category, boost::mpl::random_access_iterator_tag > >::type::value))
Assuming a sequence of sequences, find the least refined category of all subsequences.
boost::mpl::if_< boost::mpl::empty< non_random_access_iterators >, boost::mpl::random_access_iterator_tag, typenameboost::mpl::if_< boost::mpl::empty< non_bidirectional_iterators >, boost::mpl::bidirectional_iterator_tag, boost::mpl::forward_iterator_tag >::type >::type type
boost::mpl::filter_view< non_random_access_iterators, boost::mpl::not_< boost::is_same< extract_iterator_category< _1 >, boost::mpl::bidirectional_iterator_tag > > >::type non_bidirectional_iterators
Show us everything that is not categorized as either "bidirectional" OR "random access....
boost::mpl::filter_view< S, boost::mpl::not_< boost::is_same< extract_iterator_category< _1 >, boost::mpl::random_access_iterator_tag > > >::type non_random_access_iterators
Show us everything that is not categorized as "random access.".
An iterator into a sequence of sequences.
Type for tag-based implementation of algorithms below.
Wraps corresponding elements across a sequence of sequences.