• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
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 #if !defined(FUSION_CONVERT_10022005_1442)
8 #define FUSION_CONVERT_10022005_1442
9 
10 #include <boost/fusion/support/config.hpp>
11 #if BOOST_WORKAROUND(BOOST_GCC, < 30500)
12 #include <boost/core/enable_if.hpp>
13 #include <boost/type_traits/is_const.hpp>
14 #define BOOST_FUSION_WA_GCC34(type1, type2) \
15     boost::lazy_disable_if<boost::is_const<Sequence>, type1, type2>
16 #else
17 #define BOOST_FUSION_WA_GCC34(type1, type2) type1, type2
18 #endif
19 
20 namespace boost { namespace fusion
21 {
22     namespace extension
23     {
24         template <typename Tag>
25         struct convert_impl;
26     }
27 
28     namespace result_of
29     {
30         template <typename Tag, typename Sequence>
31         struct convert
32         {
33             typedef typename
34                 extension::convert_impl<Tag>::template apply<Sequence>
35             gen;
36 
37             typedef typename gen::type type;
38         };
39     }
40 
41     template <typename Tag, typename Sequence>
42     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_FUSION_WA_GCC34(result_of::convert<Tag,Sequence>)43     inline typename BOOST_FUSION_WA_GCC34(result_of::convert<Tag, Sequence>)::type
44     convert(Sequence& seq)
45     {
46         typedef typename result_of::convert<Tag, Sequence>::gen gen;
47         return gen::call(seq);
48     }
49 
50     template <typename Tag, typename Sequence>
51     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
52     inline typename result_of::convert<Tag, Sequence const>::type
convert(Sequence const & seq)53     convert(Sequence const& seq)
54     {
55         typedef typename result_of::convert<Tag, Sequence const>::gen gen;
56         return gen::call(seq);
57     }
58 }}
59 
60 #undef BOOST_FUSION_WA_GCC34
61 #endif
62