]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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/fusion/support/config.hpp> | |
12 | #include <boost/mpl/eval_if.hpp> | |
13 | #include <boost/type_traits/is_const.hpp> | |
14 | #include <boost/type_traits/add_const.hpp> | |
15 | #include <boost/type_traits/add_reference.hpp> | |
16 | ||
17 | namespace boost { namespace fusion | |
18 | { | |
19 | struct cons_iterator_tag; | |
20 | ||
21 | namespace extension | |
22 | { | |
23 | template <typename Tag> | |
24 | struct deref_impl; | |
25 | ||
26 | template <> | |
27 | struct deref_impl<cons_iterator_tag> | |
28 | { | |
29 | template <typename Iterator> | |
30 | struct apply | |
31 | { | |
32 | typedef typename Iterator::cons_type cons_type; | |
33 | typedef typename cons_type::car_type value_type; | |
34 | ||
35 | typedef typename mpl::eval_if< | |
36 | is_const<cons_type> | |
37 | , add_reference<typename add_const<value_type>::type> | |
38 | , add_reference<value_type> >::type | |
39 | type; | |
40 | ||
41 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
42 | static type | |
43 | call(Iterator const& i) | |
44 | { | |
45 | return i.cons.car; | |
46 | } | |
47 | }; | |
48 | }; | |
49 | } | |
50 | }} | |
51 | ||
52 | #endif | |
53 | ||
54 |