| 1 | |
|---|---|
| 2 | #ifndef BOOST_MPL_ZIP_VIEW_HPP_INCLUDED |
| 3 | #define BOOST_MPL_ZIP_VIEW_HPP_INCLUDED |
| 4 | |
| 5 | // Copyright Aleksey Gurtovoy 2000-2010 |
| 6 | // Copyright David Abrahams 2000-2002 |
| 7 | // |
| 8 | // Distributed under the Boost Software License, Version 1.0. |
| 9 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 10 | // http://www.boost.org/LICENSE_1_0.txt) |
| 11 | // |
| 12 | // See http://www.boost.org/libs/mpl for documentation. |
| 13 | |
| 14 | // $Id$ |
| 15 | // $Date$ |
| 16 | // $Revision$ |
| 17 | |
| 18 | #include <boost/mpl/transform.hpp> |
| 19 | #include <boost/mpl/begin_end.hpp> |
| 20 | #include <boost/mpl/iterator_tags.hpp> |
| 21 | #include <boost/mpl/next.hpp> |
| 22 | #include <boost/mpl/lambda.hpp> |
| 23 | #include <boost/mpl/deref.hpp> |
| 24 | #include <boost/mpl/aux_/na_spec.hpp> |
| 25 | |
| 26 | namespace boost { namespace mpl { |
| 27 | |
| 28 | template< typename IteratorSeq > |
| 29 | struct zip_iterator |
| 30 | { |
| 31 | typedef forward_iterator_tag category; |
| 32 | typedef typename transform1< |
| 33 | IteratorSeq |
| 34 | , deref<_1> |
| 35 | >::type type; |
| 36 | |
| 37 | typedef zip_iterator< |
| 38 | typename transform1< |
| 39 | IteratorSeq |
| 40 | , mpl::next<_1> |
| 41 | >::type |
| 42 | > next; |
| 43 | }; |
| 44 | |
| 45 | template< |
| 46 | typename BOOST_MPL_AUX_NA_PARAM(Sequences) |
| 47 | > |
| 48 | struct zip_view |
| 49 | { |
| 50 | private: |
| 51 | typedef typename transform1< Sequences, mpl::begin<_1> >::type first_ones_; |
| 52 | typedef typename transform1< Sequences, mpl::end<_1> >::type last_ones_; |
| 53 | |
| 54 | public: |
| 55 | typedef nested_begin_end_tag tag; |
| 56 | typedef zip_view type; |
| 57 | typedef zip_iterator<first_ones_> begin; |
| 58 | typedef zip_iterator<last_ones_> end; |
| 59 | }; |
| 60 | |
| 61 | BOOST_MPL_AUX_NA_SPEC(1, zip_view) |
| 62 | |
| 63 | }} |
| 64 | |
| 65 | #endif // BOOST_MPL_ZIP_VIEW_HPP_INCLUDED |
| 66 |
