]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/sequence/intrinsic/at.hpp
Added posterior standard deviation of counts as output if either '--calc-pme' or...
[rsem.git] / boost / fusion / sequence / intrinsic / at.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2006 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/support/tag_of.hpp>
13 #include <boost/fusion/support/detail/access.hpp>
14
15 namespace boost { namespace fusion
16 {
17     // Special tags:
18     struct sequence_facade_tag;
19     struct boost_tuple_tag; // boost::tuples::tuple tag
20     struct boost_array_tag; // boost::array tag
21     struct mpl_sequence_tag; // mpl sequence tag
22     struct std_pair_tag; // std::pair tag
23
24     namespace extension
25     {
26         template <typename Tag>
27         struct at_impl
28         {
29             template <typename Sequence, typename N>
30             struct apply;
31         };
32
33         template <>
34         struct at_impl<sequence_facade_tag>
35         {
36             template <typename Sequence, typename N>
37             struct apply : Sequence::template at<Sequence, N> {};
38         };
39
40         template <>
41         struct at_impl<boost_tuple_tag>;
42
43         template <>
44         struct at_impl<boost_array_tag>;
45
46         template <>
47         struct at_impl<mpl_sequence_tag>;
48
49         template <>
50         struct at_impl<std_pair_tag>;
51     }
52
53     namespace result_of
54     {
55         template <typename Sequence, typename N>
56         struct at 
57             : extension::at_impl<typename detail::tag_of<Sequence>::type>::
58                 template apply<Sequence, N>
59         {};
60
61         template <typename Sequence, int N>
62         struct at_c
63             : at<Sequence, mpl::int_<N> >
64         {};
65     }
66
67
68     template <typename N, typename Sequence>
69     inline typename 
70         lazy_disable_if<
71             is_const<Sequence>
72           , result_of::at<Sequence, N>
73         >::type
74     at(Sequence& seq)
75     {
76         return result_of::at<Sequence, N>::call(seq);
77     }
78
79     template <typename N, typename Sequence>
80     inline typename result_of::at<Sequence const, N>::type
81     at(Sequence const& seq)
82     {
83         return result_of::at<Sequence const, N>::call(seq);
84     }
85
86     template <int N, typename Sequence>
87     inline typename 
88         lazy_disable_if<
89             is_const<Sequence>
90           , result_of::at_c<Sequence, N>
91         >::type
92     at_c(Sequence& seq)
93     {
94         return fusion::at<mpl::int_<N> >(seq);
95     }
96
97     template <int N, typename Sequence>
98     inline typename result_of::at_c<Sequence const, N>::type
99     at_c(Sequence const& seq)
100     {
101         return fusion::at<mpl::int_<N> >(seq);
102     }
103 }}
104
105 #endif
106