]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/fusion/sequence/intrinsic/value_at.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / fusion / sequence / intrinsic / value_at.hpp
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_VALUE_AT_05052005_0229)
8 #define FUSION_VALUE_AT_05052005_0229
9
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/mpl/int.hpp>
12 #include <boost/mpl/if.hpp>
13 #include <boost/mpl/or.hpp>
14 #include <boost/mpl/less.hpp>
15 #include <boost/mpl/empty_base.hpp>
16 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
17 #include <boost/fusion/support/tag_of.hpp>
18 #include <boost/fusion/support/category_of.hpp>
19
20 namespace boost { namespace fusion
21 {
22 // Special tags:
23 struct sequence_facade_tag;
24 struct boost_tuple_tag; // boost::tuples::tuple tag
25 struct boost_array_tag; // boost::array tag
26 struct mpl_sequence_tag; // mpl sequence tag
27 struct std_pair_tag; // std::pair tag
28
29 namespace extension
30 {
31 template <typename Tag>
32 struct value_at_impl
33 {
34 template <typename Sequence, typename N>
35 struct apply;
36 };
37
38 template <>
39 struct value_at_impl<sequence_facade_tag>
40 {
41 template <typename Sequence, typename N>
42 struct apply : Sequence::template value_at<Sequence, N> {};
43 };
44
45 template <>
46 struct value_at_impl<boost_tuple_tag>;
47
48 template <>
49 struct value_at_impl<boost_array_tag>;
50
51 template <>
52 struct value_at_impl<mpl_sequence_tag>;
53
54 template <>
55 struct value_at_impl<std_pair_tag>;
56 }
57
58 namespace detail
59 {
60 template <typename Sequence, typename N, typename Tag>
61 struct value_at_impl
62 : mpl::if_<
63 mpl::or_<
64 mpl::less<N, typename extension::size_impl<Tag>::template apply<Sequence>::type>
65 , traits::is_unbounded<Sequence>
66 >
67 , typename extension::value_at_impl<Tag>::template apply<Sequence, N>
68 , mpl::empty_base
69 >::type
70 {};
71 }
72
73 namespace result_of
74 {
75 template <typename Sequence, typename N>
76 struct value_at
77 : detail::value_at_impl<Sequence, N, typename detail::tag_of<Sequence>::type>
78 {};
79
80 template <typename Sequence, int N>
81 struct value_at_c
82 : fusion::result_of::value_at<Sequence, mpl::int_<N> >
83 {};
84 }
85 }}
86
87 #endif
88