]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/container/vector/detail/deref_impl.hpp
RSEM Source Codes
[rsem.git] / boost / fusion / container / vector / detail / deref_impl.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2006 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
14 namespace boost { namespace fusion
15 {
16     struct vector_iterator_tag;
17
18     namespace extension
19     {
20         template <typename Tag>
21         struct deref_impl;
22
23         template <>
24         struct deref_impl<vector_iterator_tag>
25         {
26             template <typename Iterator>
27             struct apply 
28             {
29                 typedef typename Iterator::vector vector;
30                 typedef typename Iterator::index index;
31                 typedef typename mpl::at<
32                     typename vector::types, index> 
33                 element;
34                 
35                 typedef typename
36                     mpl::eval_if<
37                         is_const<vector>
38                       , fusion::detail::cref_result<element>
39                       , fusion::detail::ref_result<element>
40                     >::type
41                 type;
42
43                 static type
44                 call(Iterator const& i)
45                 {
46                     return i.vec.at_impl(index());
47                 }
48             };
49         };
50     }
51 }}
52
53 #endif