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_IMPL_07172005_0952)
8 #define FUSION_VALUE_AT_IMPL_07172005_0952
9 
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/support/detail/access.hpp>
12 #include <boost/type_traits/is_const.hpp>
13 #include <boost/mpl/eval_if.hpp>
14 #include <boost/mpl/bool.hpp>
15 
16 namespace boost { namespace fusion
17 {
18     struct cons_tag;
19 
20     namespace extension
21     {
22         template <typename Tag>
23         struct value_at_impl;
24 
25         template <>
26         struct value_at_impl<cons_tag>
27         {
28             template <typename Sequence, typename N>
29             struct apply
30             {
31                 typedef typename
32                     mpl::eval_if<
33                         mpl::bool_<N::value == 0>
34                       , mpl::identity<typename Sequence::car_type>
35                       , apply<typename Sequence::cdr_type, mpl::int_<N::value-1> >
36                     >::type
37                 type;
38             };
39         };
40     }
41 }}
42 
43 #endif
44