1 /*=============================================================================
2 Copyright (c) 2001-2006 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/support/tag_of.hpp>
13 #include <boost/fusion/support/detail/access.hpp>
15 namespace boost { namespace fusion
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
26 template <typename Tag>
29 template <typename Sequence, typename N>
34 struct at_impl<sequence_facade_tag>
36 template <typename Sequence, typename N>
37 struct apply : Sequence::template at<Sequence, N> {};
41 struct at_impl<boost_tuple_tag>;
44 struct at_impl<boost_array_tag>;
47 struct at_impl<mpl_sequence_tag>;
50 struct at_impl<std_pair_tag>;
55 template <typename Sequence, typename N>
57 : extension::at_impl<typename detail::tag_of<Sequence>::type>::
58 template apply<Sequence, N>
61 template <typename Sequence, int N>
63 : at<Sequence, mpl::int_<N> >
68 template <typename N, typename Sequence>
72 , result_of::at<Sequence, N>
76 return result_of::at<Sequence, N>::call(seq);
79 template <typename N, typename Sequence>
80 inline typename result_of::at<Sequence const, N>::type
81 at(Sequence const& seq)
83 return result_of::at<Sequence const, N>::call(seq);
86 template <int N, typename Sequence>
90 , result_of::at_c<Sequence, N>
94 return fusion::at<mpl::int_<N> >(seq);
97 template <int N, typename Sequence>
98 inline typename result_of::at_c<Sequence const, N>::type
99 at_c(Sequence const& seq)
101 return fusion::at<mpl::int_<N> >(seq);