Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / container / map / detail / cpp03 / deref_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_IMPL_HPP
9 #define BOOST_FUSION_CONTAINER_MAP_DETAIL_DEREF_IMPL_HPP
10
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/sequence/intrinsic/at.hpp>
13 #include <boost/type_traits/is_const.hpp>
14
15 namespace boost { namespace fusion { namespace extension
16 {
17     template <typename>
18     struct deref_impl;
19
20     template <>
21     struct deref_impl<map_iterator_tag>
22     {
23         template <typename It>
24         struct apply
25         {
26             typedef typename
27                 result_of::at<
28                     typename mpl::if_<
29                         is_const<typename It::seq_type>
30                       , typename It::seq_type::storage_type const
31                       , typename It::seq_type::storage_type
32                     >::type
33                   , typename It::index
34                 >::type
35             type;
36
37             BOOST_FUSION_GPU_ENABLED
38             static type
39             call(It const& it)
40             {
41                 return fusion::at<typename It::index>(it.seq->get_data());
42             }
43         };
44     };
45 }}}
46
47 #endif