]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/container/vector/detail/deref_impl.hpp
Updated boost to v1.55.0
[rsem.git] / boost / fusion / container / vector / detail / deref_impl.hpp
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_DEREF_IMPL_05042005_1037)
8 #define FUSION_DEREF_IMPL_05042005_1037
9
10 #include <boost/mpl/at.hpp>
11 #include <boost/fusion/support/detail/access.hpp>
12 #include <boost/type_traits/is_const.hpp>
13 #include <boost/mpl/if.hpp>
14
15 namespace boost { namespace fusion
16 {
17     struct vector_iterator_tag;
18
19     namespace extension
20     {
21         template <typename Tag>
22         struct deref_impl;
23
24         template <>
25         struct deref_impl<vector_iterator_tag>
26         {
27             template <typename Iterator>
28             struct apply 
29             {
30                 typedef typename Iterator::vector vector;
31                 typedef typename Iterator::index index;
32                 typedef typename mpl::at<
33                     typename vector::types, index>::type
34                 element;
35                 
36                 typedef typename
37                     mpl::if_<
38                         is_const<vector>
39                       , typename fusion::detail::cref_result<element>::type
40                       , typename fusion::detail::ref_result<element>::type
41                     >::type
42                 type;
43
44                 static type
45                 call(Iterator const& i)
46                 {
47                     return i.vec.at_impl(index());
48                 }
49             };
50         };
51     }
52 }}
53
54 #endif