Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/fusion/sequence/intrinsic/at.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_AT_05042005_0722) | |
8 #define FUSION_AT_05042005_0722 | |
9 | |
10 #include <boost/mpl/int.hpp> | |
11 #include <boost/type_traits/is_const.hpp> | |
12 #include <boost/fusion/sequence/intrinsic_fwd.hpp> | |
13 #include <boost/fusion/support/tag_of.hpp> | |
14 #include <boost/fusion/support/detail/access.hpp> | |
15 | |
16 namespace boost { namespace fusion | |
17 { | |
18 // Special tags: | |
19 struct sequence_facade_tag; | |
20 struct boost_tuple_tag; // boost::tuples::tuple tag | |
21 struct boost_array_tag; // boost::array tag | |
22 struct mpl_sequence_tag; // mpl sequence tag | |
23 struct std_pair_tag; // std::pair tag | |
24 struct std_tuple_tag; // std::tuple tag | |
25 | |
26 namespace extension | |
27 { | |
28 template <typename Tag> | |
29 struct at_impl | |
30 { | |
31 template <typename Sequence, typename N> | |
32 struct apply; | |
33 }; | |
34 | |
35 template <> | |
36 struct at_impl<sequence_facade_tag> | |
37 { | |
38 template <typename Sequence, typename N> | |
39 struct apply : Sequence::template at<Sequence, N> {}; | |
40 }; | |
41 | |
42 template <> | |
43 struct at_impl<boost_tuple_tag>; | |
44 | |
45 template <> | |
46 struct at_impl<boost_array_tag>; | |
47 | |
48 template <> | |
49 struct at_impl<mpl_sequence_tag>; | |
50 | |
51 template <> | |
52 struct at_impl<std_pair_tag>; | |
53 | |
54 template <> | |
55 struct at_impl<std_tuple_tag>; | |
56 } | |
57 | |
58 namespace result_of | |
59 { | |
60 template <typename Sequence, typename N> | |
61 struct at | |
62 : extension::at_impl<typename detail::tag_of<Sequence>::type>:: | |
63 template apply<Sequence, N> | |
64 {}; | |
65 | |
66 template <typename Sequence, int N> | |
67 struct at_c | |
68 : at<Sequence, mpl::int_<N> > | |
69 {}; | |
70 } | |
71 | |
72 | |
73 template <typename N, typename Sequence> | |
74 inline typename | |
75 lazy_disable_if< | |
76 is_const<Sequence> | |
77 , result_of::at<Sequence, N> | |
78 >::type | |
79 at(Sequence& seq) | |
80 { | |
81 return result_of::at<Sequence, N>::call(seq); | |
82 } | |
83 | |
84 template <typename N, typename Sequence> | |
85 inline typename result_of::at<Sequence const, N>::type | |
86 at(Sequence const& seq) | |
87 { | |
88 return result_of::at<Sequence const, N>::call(seq); | |
89 } | |
90 | |
91 template <int N, typename Sequence> | |
92 inline typename | |
93 lazy_disable_if< | |
94 is_const<Sequence> | |
95 , result_of::at_c<Sequence, N> | |
96 >::type | |
97 at_c(Sequence& seq) | |
98 { | |
99 return fusion::at<mpl::int_<N> >(seq); | |
100 } | |
101 | |
102 template <int N, typename Sequence> | |
103 inline typename result_of::at_c<Sequence const, N>::type | |
104 at_c(Sequence const& seq) | |
105 { | |
106 return fusion::at<mpl::int_<N> >(seq); | |
107 } | |
108 }} | |
109 | |
110 #endif | |
111 |