Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2011 Joel de Guzman
|
Chris@16
|
3
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 ==============================================================================*/
|
Chris@16
|
7 #if !defined(FUSION_VALUE_AT_05052005_0229)
|
Chris@16
|
8 #define FUSION_VALUE_AT_05052005_0229
|
Chris@16
|
9
|
Chris@101
|
10 #include <boost/fusion/support/config.hpp>
|
Chris@16
|
11 #include <boost/mpl/int.hpp>
|
Chris@16
|
12 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
|
Chris@16
|
13 #include <boost/fusion/support/tag_of.hpp>
|
Chris@16
|
14
|
Chris@16
|
15 namespace boost { namespace fusion
|
Chris@16
|
16 {
|
Chris@16
|
17 // Special tags:
|
Chris@16
|
18 struct sequence_facade_tag;
|
Chris@16
|
19 struct boost_tuple_tag; // boost::tuples::tuple tag
|
Chris@16
|
20 struct boost_array_tag; // boost::array tag
|
Chris@16
|
21 struct mpl_sequence_tag; // mpl sequence tag
|
Chris@16
|
22 struct std_pair_tag; // std::pair tag
|
Chris@16
|
23
|
Chris@16
|
24 namespace extension
|
Chris@16
|
25 {
|
Chris@16
|
26 template <typename Tag>
|
Chris@16
|
27 struct value_at_impl
|
Chris@16
|
28 {
|
Chris@16
|
29 template <typename Sequence, typename N>
|
Chris@16
|
30 struct apply;
|
Chris@16
|
31 };
|
Chris@16
|
32
|
Chris@16
|
33 template <>
|
Chris@16
|
34 struct value_at_impl<sequence_facade_tag>
|
Chris@16
|
35 {
|
Chris@16
|
36 template <typename Sequence, typename N>
|
Chris@16
|
37 struct apply : Sequence::template value_at<Sequence, N> {};
|
Chris@16
|
38 };
|
Chris@16
|
39
|
Chris@16
|
40 template <>
|
Chris@16
|
41 struct value_at_impl<boost_tuple_tag>;
|
Chris@16
|
42
|
Chris@16
|
43 template <>
|
Chris@16
|
44 struct value_at_impl<boost_array_tag>;
|
Chris@16
|
45
|
Chris@16
|
46 template <>
|
Chris@16
|
47 struct value_at_impl<mpl_sequence_tag>;
|
Chris@16
|
48
|
Chris@16
|
49 template <>
|
Chris@16
|
50 struct value_at_impl<std_pair_tag>;
|
Chris@16
|
51 }
|
Chris@16
|
52
|
Chris@16
|
53 namespace result_of
|
Chris@16
|
54 {
|
Chris@16
|
55 template <typename Sequence, typename N>
|
Chris@16
|
56 struct value_at
|
Chris@16
|
57 : extension::value_at_impl<typename detail::tag_of<Sequence>::type>::
|
Chris@16
|
58 template apply<Sequence, N>
|
Chris@16
|
59 {};
|
Chris@16
|
60
|
Chris@16
|
61 template <typename Sequence, int N>
|
Chris@16
|
62 struct value_at_c
|
Chris@16
|
63 : fusion::result_of::value_at<Sequence, mpl::int_<N> >
|
Chris@16
|
64 {};
|
Chris@16
|
65 }
|
Chris@16
|
66 }}
|
Chris@16
|
67
|
Chris@16
|
68 #endif
|
Chris@16
|
69
|