Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / container / map / detail / cpp03 / convert_impl.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2005-2006 Dan Marsden
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_CONVERT_IMPL_09232005_1340)
9 #define FUSION_CONVERT_IMPL_09232005_1340
10
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/container/map/detail/cpp03/as_map.hpp>
13 #include <boost/fusion/container/map/detail/cpp03/map.hpp>
14 #include <boost/fusion/sequence/intrinsic/begin.hpp>
15 #include <boost/fusion/sequence/intrinsic/size.hpp>
16
17 namespace boost { namespace fusion
18 {
19     struct map_tag;
20
21     namespace extension
22     {
23         template <typename T>
24         struct convert_impl;
25
26         template <>
27         struct convert_impl<map_tag>
28         {
29             template <typename Sequence>
30             struct apply
31             {
32                 typedef typename
33                     detail::as_map<
34                         result_of::size<Sequence>::value
35                       , is_base_of<
36                             associative_tag
37                           , typename traits::category_of<Sequence>::type>::value
38                     >
39                 gen;
40                 typedef typename gen::
41                     template apply<typename result_of::begin<Sequence>::type>::type
42                 type;
43
44                 BOOST_FUSION_GPU_ENABLED
45                 static type call(Sequence& seq)
46                 {
47                     return gen::call(fusion::begin(seq));
48                 }
49             };
50         };
51     }
52 }}
53
54 #endif