1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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
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>
16 namespace boost { namespace fusion
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
28 template <typename Tag>
31 template <typename Sequence, typename N>
36 struct at_impl<sequence_facade_tag>
38 template <typename Sequence, typename N>
39 struct apply : Sequence::template at<Sequence, N> {};
43 struct at_impl<boost_tuple_tag>;
46 struct at_impl<boost_array_tag>;
49 struct at_impl<mpl_sequence_tag>;
52 struct at_impl<std_pair_tag>;
55 struct at_impl<std_tuple_tag>;
60 template <typename Sequence, typename N>
62 : extension::at_impl<typename detail::tag_of<Sequence>::type>::
63 template apply<Sequence, N>
66 template <typename Sequence, int N>
68 : at<Sequence, mpl::int_<N> >
73 template <typename N, typename Sequence>
77 , result_of::at<Sequence, N>
81 return result_of::at<Sequence, N>::call(seq);
84 template <typename N, typename Sequence>
85 inline typename result_of::at<Sequence const, N>::type
86 at(Sequence const& seq)
88 return result_of::at<Sequence const, N>::call(seq);
91 template <int N, typename Sequence>
95 , result_of::at_c<Sequence, N>
99 return fusion::at<mpl::int_<N> >(seq);
102 template <int N, typename Sequence>
103 inline typename result_of::at_c<Sequence const, N>::type
104 at_c(Sequence const& seq)
106 return fusion::at<mpl::int_<N> >(seq);