Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/fusion/view/joint_view/joint_view.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================= | |
2 Copyright (c) 2001-2011 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/view/joint_view/joint_view_fwd.hpp> | |
11 #include <boost/fusion/support/detail/access.hpp> | |
12 #include <boost/fusion/support/is_view.hpp> | |
13 #include <boost/fusion/sequence/intrinsic/begin.hpp> | |
14 #include <boost/fusion/sequence/intrinsic/end.hpp> | |
15 #include <boost/fusion/sequence/intrinsic/size.hpp> | |
16 #include <boost/fusion/view/joint_view/joint_view_iterator.hpp> | |
17 #include <boost/fusion/view/joint_view/detail/begin_impl.hpp> | |
18 #include <boost/fusion/view/joint_view/detail/end_impl.hpp> | |
19 #include <boost/fusion/support/sequence_base.hpp> | |
20 #include <boost/mpl/if.hpp> | |
21 #include <boost/mpl/plus.hpp> | |
22 #include <boost/mpl/bool.hpp> | |
23 #include <boost/mpl/eval_if.hpp> | |
24 #include <boost/mpl/inherit.hpp> | |
25 #include <boost/mpl/identity.hpp> | |
26 | |
27 namespace boost { namespace fusion | |
28 { | |
29 struct joint_view_tag; | |
30 struct forward_traversal_tag; | |
31 struct fusion_sequence_tag; | |
32 | |
33 template <typename Sequence1, typename Sequence2> | |
34 struct joint_view : sequence_base<joint_view<Sequence1, Sequence2> > | |
35 { | |
36 typedef joint_view_tag fusion_tag; | |
37 typedef fusion_sequence_tag tag; // this gets picked up by MPL | |
38 typedef typename | |
39 mpl::eval_if< | |
40 mpl::and_< | |
41 traits::is_associative<Sequence1> | |
42 , traits::is_associative<Sequence2> | |
43 > | |
44 , mpl::inherit2<forward_traversal_tag,associative_tag> | |
45 , mpl::identity<forward_traversal_tag> | |
46 >::type | |
47 category; | |
48 typedef mpl::true_ is_view; | |
49 | |
50 typedef typename result_of::begin<Sequence1>::type first_type; | |
51 typedef typename result_of::end<Sequence1>::type last_type; | |
52 typedef typename result_of::begin<Sequence2>::type concat_type; | |
53 typedef typename result_of::end<Sequence2>::type concat_last_type; | |
54 typedef typename mpl::int_< | |
55 result_of::size<Sequence1>::value + result_of::size<Sequence2>::value> | |
56 size; | |
57 | |
58 joint_view(Sequence1& in_seq1, Sequence2& in_seq2) | |
59 : seq1(in_seq1) | |
60 , seq2(in_seq2) | |
61 {} | |
62 | |
63 first_type first() const { return fusion::begin(seq1); } | |
64 concat_type concat() const { return fusion::begin(seq2); } | |
65 concat_last_type concat_last() const { return fusion::end(seq2); } | |
66 | |
67 private: | |
68 // silence MSVC warning C4512: assignment operator could not be generated | |
69 joint_view& operator= (joint_view const&); | |
70 | |
71 typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1; | |
72 typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2; | |
73 }; | |
74 }} | |
75 | |
76 #endif | |
77 | |
78 |