]> git.lyx.org Git - features.git/blob - boost/boost/mpl/zip_view.hpp
7e8e1ac716722196cead95fc5ebfecb76a174605
[features.git] / boost / boost / mpl / zip_view.hpp
1
2 #ifndef BOOST_MPL_ZIP_VIEW_HPP_INCLUDED
3 #define BOOST_MPL_ZIP_VIEW_HPP_INCLUDED
4
5 // Copyright Aleksey Gurtovoy 2000-2002
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: zip_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
15 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
16 // $Revision: 49267 $
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_iterator<first_ones_> begin;
57     typedef zip_iterator<last_ones_> end;
58 };
59
60 BOOST_MPL_AUX_NA_SPEC(1, zip_view)
61
62 }}
63
64 #endif // BOOST_MPL_ZIP_VIEW_HPP_INCLUDED