Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/fusion/sequence/intrinsic/begin.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_BEGIN_04052005_1132) | |
8 #define FUSION_BEGIN_04052005_1132 | |
9 | |
10 #include <boost/blank.hpp> | |
11 #include <boost/utility/enable_if.hpp> | |
12 #include <boost/mpl/if.hpp> | |
13 #include <boost/fusion/sequence/intrinsic_fwd.hpp> | |
14 #include <boost/fusion/support/tag_of.hpp> | |
15 #include <boost/fusion/support/is_sequence.hpp> | |
16 #include <boost/fusion/support/is_segmented.hpp> | |
17 #include <boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp> | |
18 | |
19 namespace boost { namespace fusion | |
20 { | |
21 // Special tags: | |
22 struct sequence_facade_tag; // iterator facade tag | |
23 struct boost_tuple_tag; // boost::tuples::tuple tag | |
24 struct boost_array_tag; // boost::array tag | |
25 struct mpl_sequence_tag; // mpl sequence tag | |
26 struct std_pair_tag; // std::pair tag | |
27 | |
28 namespace extension | |
29 { | |
30 template <typename Tag> | |
31 struct begin_impl | |
32 { | |
33 template <typename Sequence> | |
34 struct apply | |
35 : mpl::if_< | |
36 traits::is_segmented<Sequence> | |
37 , detail::segmented_begin<Sequence> | |
38 , blank | |
39 >::type | |
40 {}; | |
41 }; | |
42 | |
43 template <> | |
44 struct begin_impl<sequence_facade_tag> | |
45 { | |
46 template <typename Sequence> | |
47 struct apply : Sequence::template begin<Sequence> {}; | |
48 }; | |
49 | |
50 template <> | |
51 struct begin_impl<boost_tuple_tag>; | |
52 | |
53 template <> | |
54 struct begin_impl<boost_array_tag>; | |
55 | |
56 template <> | |
57 struct begin_impl<mpl_sequence_tag>; | |
58 | |
59 template <> | |
60 struct begin_impl<std_pair_tag>; | |
61 } | |
62 | |
63 namespace result_of | |
64 { | |
65 template <typename Sequence> | |
66 struct begin | |
67 : extension::begin_impl<typename detail::tag_of<Sequence>::type>:: | |
68 template apply<Sequence> | |
69 {}; | |
70 } | |
71 | |
72 template <typename Sequence> | |
73 inline typename | |
74 lazy_enable_if< | |
75 traits::is_sequence<Sequence> | |
76 , result_of::begin<Sequence> | |
77 >::type const | |
78 begin(Sequence& seq) | |
79 { | |
80 return result_of::begin<Sequence>::call(seq); | |
81 } | |
82 | |
83 template <typename Sequence> | |
84 inline typename | |
85 lazy_enable_if< | |
86 traits::is_sequence<Sequence> | |
87 , result_of::begin<Sequence const> | |
88 >::type const | |
89 begin(Sequence const& seq) | |
90 { | |
91 return result_of::begin<Sequence const>::call(seq); | |
92 } | |
93 }} | |
94 | |
95 #endif |