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(BOOST_FUSION_AT_IMPL_09262006_1920)
8 #define BOOST_FUSION_AT_IMPL_09262006_1920
9 
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/tuple/tuple.hpp>
12 #include <boost/mpl/if.hpp>
13 
14 namespace boost { namespace fusion
15 {
16     struct boost_tuple_tag;
17 
18     namespace extension
19     {
20         template<typename T>
21         struct at_impl;
22 
23         template <>
24         struct at_impl<boost_tuple_tag>
25         {
26             template <typename Sequence, typename N>
27             struct apply
28             {
29                 typedef typename
30                     tuples::element<N::value, Sequence>::type
31                 element;
32 
33                 typedef typename
34                     mpl::if_<
35                         is_const<Sequence>
36                       , typename tuples::access_traits<element>::const_type
37                       , typename tuples::access_traits<element>::non_const_type
38                     >::type
39                 type;
40 
41                 BOOST_FUSION_GPU_ENABLED
42                 static type
callboost::fusion::extension::at_impl::apply43                 call(Sequence& seq)
44                 {
45                     return tuples::get<N::value>(seq);
46                 }
47             };
48         };
49     }
50 }}
51 
52 #endif
53