Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / mpl / joint_view.hpp
1
2 #ifndef BOOST_MPL_JOINT_VIEW_HPP_INCLUDED
3 #define BOOST_MPL_JOINT_VIEW_HPP_INCLUDED
4
5 // Copyright Aleksey Gurtovoy 2000-2004
6 //
7 // Distributed under the Boost Software License, Version 1.0. 
8 // (See accompanying file LICENSE_1_0.txt or copy at 
9 // http://www.boost.org/LICENSE_1_0.txt)
10 //
11 // See http://www.boost.org/libs/mpl for documentation.
12
13 // $Id$
14 // $Date$
15 // $Revision$
16
17 #include <boost/mpl/aux_/joint_iter.hpp>
18 #include <boost/mpl/plus.hpp>
19 #include <boost/mpl/size_fwd.hpp>
20 #include <boost/mpl/begin_end.hpp>
21 #include <boost/mpl/aux_/na_spec.hpp>
22
23 namespace boost { namespace mpl {
24
25 namespace aux {
26 struct joint_view_tag;
27 }
28
29 template<>
30 struct size_impl< aux::joint_view_tag >
31 {
32     template < typename JointView > struct apply
33       : plus<
34             size<typename JointView::sequence1_>
35           , size<typename JointView::sequence2_>
36           >
37     {};
38 };
39
40 template<
41       typename BOOST_MPL_AUX_NA_PARAM(Sequence1_)
42     , typename BOOST_MPL_AUX_NA_PARAM(Sequence2_)
43     >
44 struct joint_view
45 {
46     typedef typename mpl::begin<Sequence1_>::type   first1_;
47     typedef typename mpl::end<Sequence1_>::type     last1_;
48     typedef typename mpl::begin<Sequence2_>::type   first2_;
49     typedef typename mpl::end<Sequence2_>::type     last2_;
50
51     // agurt, 25/may/03: for the 'size_traits' implementation above
52     typedef Sequence1_ sequence1_;
53     typedef Sequence2_ sequence2_;
54
55     typedef joint_view type;
56     typedef aux::joint_view_tag tag;
57     typedef joint_iter<first1_,last1_,first2_>  begin;
58     typedef joint_iter<last1_,last1_,last2_>    end;
59 };
60
61 BOOST_MPL_AUX_NA_SPEC(2, joint_view)
62
63 }}
64
65 #endif // BOOST_MPL_JOINT_VIEW_HPP_INCLUDED