File indexing completed on 2025-01-18 09:33:39
0001
0002
0003
0004
0005
0006
0007 #if !defined(FUSION_CONVERT_MAIN_09232005_1340)
0008 #define FUSION_CONVERT_MAIN_09232005_1340
0009
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/container/map/map.hpp>
0012
0013 namespace boost { namespace fusion { namespace detail
0014 {
0015 template <typename It, bool is_assoc>
0016 struct pair_from
0017 {
0018 typedef typename result_of::value_of<It>::type type;
0019
0020 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0021 static inline type call(It const& it)
0022 {
0023 return *it;
0024 }
0025 };
0026
0027 template <typename It>
0028 struct pair_from<It, true>
0029 {
0030 typedef typename result_of::key_of<It>::type key_type;
0031 typedef typename result_of::value_of_data<It>::type data_type;
0032 typedef typename fusion::pair<key_type, data_type> type;
0033
0034 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0035 static inline type call(It const& it)
0036 {
0037 return type(deref_data(it));
0038 }
0039 };
0040 }}}
0041
0042
0043
0044
0045 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
0046 # include <boost/fusion/container/map/detail/cpp03/convert.hpp>
0047
0048 #else
0049
0050
0051
0052 #include <boost/fusion/container/map/detail/build_map.hpp>
0053
0054 namespace boost { namespace fusion
0055 {
0056 namespace result_of
0057 {
0058 template <typename Sequence>
0059 struct as_map :
0060 detail::build_map<
0061 typename result_of::begin<Sequence>::type
0062 , typename result_of::end<Sequence>::type
0063 , is_base_of<
0064 associative_tag
0065 , typename traits::category_of<Sequence>::type>::value
0066 >
0067 {
0068 };
0069 }
0070
0071 template <typename Sequence>
0072 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0073 inline typename result_of::as_map<Sequence>::type
0074 as_map(Sequence& seq)
0075 {
0076 typedef result_of::as_map<Sequence> gen;
0077 return gen::call(fusion::begin(seq), fusion::end(seq));
0078 }
0079
0080 template <typename Sequence>
0081 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0082 inline typename result_of::as_map<Sequence const>::type
0083 as_map(Sequence const& seq)
0084 {
0085 typedef result_of::as_map<Sequence const> gen;
0086 return gen::call(fusion::begin(seq), fusion::end(seq));
0087 }
0088
0089 namespace extension
0090 {
0091 template <typename T>
0092 struct convert_impl;
0093
0094 template <>
0095 struct convert_impl<map_tag>
0096 {
0097 template <typename Sequence>
0098 struct apply
0099 {
0100 typedef typename
0101 result_of::as_map<Sequence>::type
0102 type;
0103
0104 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0105 static type call(Sequence& seq)
0106 {
0107 typedef result_of::as_map<Sequence> gen;
0108 return gen::call(fusion::begin(seq), fusion::end(seq));
0109 }
0110 };
0111 };
0112 }
0113 }}
0114
0115 #endif
0116 #endif
0117