~tsarev/boostdc/cmake

« back to all changes in this revision

Viewing changes to boost/boost/fusion/view/joint_view/joint_view.hpp

  • Committer: bigmuscle
  • Date: 2010-05-08 08:47:15 UTC
  • Revision ID: svn-v4:5fb55d53-692c-0410-a46a-e90ab66e00ee:trunk:497
removed old boost version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=============================================================================
2
 
    Copyright (c) 2001-2006 Joel de Guzman
3
 
 
4
 
    Distributed under the Boost Software License, Version 1.0. (See accompanying 
5
 
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
 
==============================================================================*/
7
 
#if !defined(FUSION_JOINT_VIEW_07162005_0140)
8
 
#define FUSION_JOINT_VIEW_07162005_0140
9
 
 
10
 
#include <boost/fusion/support/detail/access.hpp>
11
 
#include <boost/fusion/support/is_view.hpp>
12
 
#include <boost/fusion/sequence/intrinsic/begin.hpp>
13
 
#include <boost/fusion/sequence/intrinsic/end.hpp>
14
 
#include <boost/fusion/sequence/intrinsic/size.hpp>
15
 
#include <boost/fusion/view/joint_view/joint_view_iterator.hpp>
16
 
#include <boost/fusion/view/joint_view/detail/begin_impl.hpp>
17
 
#include <boost/fusion/view/joint_view/detail/end_impl.hpp>
18
 
#include <boost/fusion/support/sequence_base.hpp>
19
 
#include <boost/mpl/if.hpp>
20
 
#include <boost/mpl/plus.hpp>
21
 
#include <boost/mpl/bool.hpp>
22
 
 
23
 
namespace boost { namespace fusion
24
 
{
25
 
    struct joint_view_tag;
26
 
    struct forward_traversal_tag;
27
 
    struct fusion_sequence_tag;
28
 
 
29
 
    template <typename Sequence1, typename Sequence2>
30
 
    struct joint_view : sequence_base<joint_view<Sequence1, Sequence2> >
31
 
    {
32
 
        typedef joint_view_tag fusion_tag;
33
 
        typedef fusion_sequence_tag tag; // this gets picked up by MPL
34
 
        typedef forward_traversal_tag category;
35
 
        typedef mpl::true_ is_view;
36
 
 
37
 
        typedef typename result_of::begin<Sequence1>::type first_type;
38
 
        typedef typename result_of::end<Sequence1>::type last_type;
39
 
        typedef typename result_of::begin<Sequence2>::type concat_type;
40
 
        typedef typename result_of::end<Sequence2>::type concat_last_type;
41
 
        typedef typename mpl::plus<result_of::size<Sequence1>, result_of::size<Sequence2> >::type size;
42
 
 
43
 
        joint_view(Sequence1& seq1, Sequence2& seq2)
44
 
            : seq1(seq1)
45
 
            , seq2(seq2)
46
 
        {}
47
 
 
48
 
        first_type first() const { return fusion::begin(seq1); }
49
 
        concat_type concat() const { return fusion::begin(seq2); }
50
 
        concat_last_type concat_last() const { return fusion::end(seq2); }
51
 
 
52
 
    private:
53
 
 
54
 
        typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1;
55
 
        typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2;
56
 
    };
57
 
}}
58
 
 
59
 
#endif
60
 
 
61