Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / container / map / detail / cpp03 / deref_data_impl.hpp
1 /*=============================================================================
2     Copyright (c) 2009 Christopher Schmidt
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
8 #ifndef BOOST_FUSION_CONTAINER_MAP_DETAIL_DEREF_DATA_IMPL_HPP
9 #define BOOST_FUSION_CONTAINER_MAP_DETAIL_DEREF_DATA_IMPL_HPP
10
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/iterator/value_of.hpp>
13 #include <boost/fusion/iterator/deref.hpp>
14 #include <boost/fusion/support/detail/access.hpp>
15 #include <boost/type_traits/is_const.hpp>
16 #include <boost/mpl/if.hpp>
17
18 namespace boost { namespace fusion { namespace extension
19 {
20     template <typename>
21     struct deref_data_impl;
22
23     template <>
24     struct deref_data_impl<map_iterator_tag>
25     {
26         template <typename It>
27         struct apply
28         {
29             typedef typename result_of::value_of<It>::type::second_type data;
30
31             typedef typename
32                 mpl::if_<
33                     is_const<typename It::seq_type>
34                   , typename detail::cref_result<data>::type
35                   , typename detail::ref_result<data>::type
36                 >::type
37             type;
38
39             BOOST_FUSION_GPU_ENABLED
40             static type
41             call(It const& it)
42             {
43                 return fusion::deref(it).second;
44             }
45         };
46     };
47 }}}
48
49 #endif