]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/container/list/detail/deref_impl.hpp
Updated boost to v1.55.0
[rsem.git] / boost / fusion / container / list / detail / deref_impl.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2005 Eric Niebler
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(FUSION_DEREF_IMPL_07172005_0831)
9 #define FUSION_DEREF_IMPL_07172005_0831
10
11 #include <boost/mpl/eval_if.hpp>
12 #include <boost/type_traits/is_const.hpp>
13 #include <boost/type_traits/add_const.hpp>
14 #include <boost/type_traits/add_reference.hpp>
15
16 namespace boost { namespace fusion
17 {
18     struct cons_iterator_tag;
19
20     namespace extension
21     {
22         template <typename Tag>
23         struct deref_impl;
24
25         template <>
26         struct deref_impl<cons_iterator_tag>
27         {
28             template <typename Iterator>
29             struct apply 
30             {
31                 typedef typename Iterator::cons_type cons_type;
32                 typedef typename cons_type::car_type value_type;
33     
34                 typedef typename mpl::eval_if<
35                     is_const<cons_type>
36                   , add_reference<typename add_const<value_type>::type>
37                   , add_reference<value_type> >::type
38                 type;
39     
40                 static type
41                 call(Iterator const& i)
42                 {
43                     return i.cons.car;
44                 }
45             };
46         };
47     }
48 }}
49
50 #endif
51
52