Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / adapted / boost_array / detail / at_impl.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2005-2006 Dan Marsden
4
5     Distributed under the Boost Software License, Version 1.0. (See accompanying 
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(BOOST_FUSION_AT_IMPL_27122005_1241)
9 #define BOOST_FUSION_AT_IMPL_27122005_1241
10
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/type_traits/is_const.hpp>
13
14 #include <boost/mpl/if.hpp>
15
16 namespace boost { namespace fusion {
17     
18     struct boost_array_tag;
19
20     namespace extension
21     {
22         template<typename T>
23         struct at_impl;
24
25         template<>
26         struct at_impl<boost_array_tag>
27         {
28             template<typename Sequence, typename N>
29             struct apply
30             {
31                 typedef typename mpl::if_<
32                     is_const<Sequence>, 
33                     typename Sequence::const_reference, 
34                     typename Sequence::reference>::type type;
35
36                 BOOST_FUSION_GPU_ENABLED
37                 static type
38                 call(Sequence& seq)
39                 {
40                     return seq[N::value];
41                 }
42             };
43         };
44     }
45 }}
46
47 #endif