annotate DEPENDENCIES/generic/include/boost/fusion/container/map/convert.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /*=============================================================================
Chris@16 2 Copyright (c) 2001-2011 Joel de Guzman
Chris@16 3
Chris@16 4 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 ==============================================================================*/
Chris@16 7 #if !defined(FUSION_CONVERT_MAIN_09232005_1340)
Chris@16 8 #define FUSION_CONVERT_MAIN_09232005_1340
Chris@16 9
Chris@101 10 #include <boost/fusion/support/config.hpp>
Chris@16 11 #include <boost/fusion/container/map/map.hpp>
Chris@16 12
Chris@101 13 namespace boost { namespace fusion { namespace detail
Chris@101 14 {
Chris@101 15 template <typename It, bool is_assoc>
Chris@101 16 struct pair_from
Chris@101 17 {
Chris@101 18 typedef typename result_of::value_of<It>::type type;
Chris@101 19
Chris@101 20 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
Chris@101 21 static inline type call(It const& it)
Chris@101 22 {
Chris@101 23 return *it;
Chris@101 24 }
Chris@101 25 };
Chris@101 26
Chris@101 27 template <typename It>
Chris@101 28 struct pair_from<It, true>
Chris@101 29 {
Chris@101 30 typedef typename result_of::key_of<It>::type key_type;
Chris@101 31 typedef typename result_of::value_of_data<It>::type data_type;
Chris@101 32 typedef typename fusion::pair<key_type, data_type> type;
Chris@101 33
Chris@101 34 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
Chris@101 35 static inline type call(It const& it)
Chris@101 36 {
Chris@101 37 return type(deref_data(it));
Chris@101 38 }
Chris@101 39 };
Chris@101 40 }}}
Chris@101 41
Chris@16 42 ///////////////////////////////////////////////////////////////////////////////
Chris@16 43 // Without variadics, we will use the PP version
Chris@16 44 ///////////////////////////////////////////////////////////////////////////////
Chris@16 45 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
Chris@16 46 # include <boost/fusion/container/map/detail/cpp03/convert.hpp>
Chris@16 47
Chris@16 48 #else
Chris@16 49 ///////////////////////////////////////////////////////////////////////////////
Chris@16 50 // C++11 variadic implementation
Chris@16 51 ///////////////////////////////////////////////////////////////////////////////
Chris@16 52 #include <boost/fusion/container/map/detail/build_map.hpp>
Chris@16 53
Chris@16 54 namespace boost { namespace fusion
Chris@16 55 {
Chris@16 56 namespace result_of
Chris@16 57 {
Chris@16 58 template <typename Sequence>
Chris@16 59 struct as_map :
Chris@16 60 detail::build_map<
Chris@16 61 typename result_of::begin<Sequence>::type
Chris@16 62 , typename result_of::end<Sequence>::type
Chris@101 63 , is_base_of<
Chris@101 64 associative_tag
Chris@101 65 , typename traits::category_of<Sequence>::type>::value
Chris@16 66 >
Chris@16 67 {
Chris@16 68 };
Chris@16 69 }
Chris@16 70
Chris@16 71 template <typename Sequence>
Chris@101 72 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
Chris@16 73 inline typename result_of::as_map<Sequence>::type
Chris@16 74 as_map(Sequence& seq)
Chris@16 75 {
Chris@16 76 typedef result_of::as_map<Sequence> gen;
Chris@16 77 return gen::call(fusion::begin(seq), fusion::end(seq));
Chris@16 78 }
Chris@16 79
Chris@16 80 template <typename Sequence>
Chris@101 81 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
Chris@16 82 inline typename result_of::as_map<Sequence const>::type
Chris@16 83 as_map(Sequence const& seq)
Chris@16 84 {
Chris@16 85 typedef result_of::as_map<Sequence const> gen;
Chris@16 86 return gen::call(fusion::begin(seq), fusion::end(seq));
Chris@16 87 }
Chris@16 88
Chris@16 89 namespace extension
Chris@16 90 {
Chris@16 91 template <typename T>
Chris@16 92 struct convert_impl;
Chris@16 93
Chris@16 94 template <>
Chris@16 95 struct convert_impl<map_tag>
Chris@16 96 {
Chris@16 97 template <typename Sequence>
Chris@16 98 struct apply
Chris@16 99 {
Chris@16 100 typedef typename
Chris@16 101 result_of::as_map<Sequence>::type
Chris@16 102 type;
Chris@16 103
Chris@101 104 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
Chris@16 105 static type call(Sequence& seq)
Chris@16 106 {
Chris@16 107 typedef result_of::as_map<Sequence> gen;
Chris@16 108 return gen::call(fusion::begin(seq), fusion::end(seq));
Chris@16 109 }
Chris@16 110 };
Chris@16 111 };
Chris@16 112 }
Chris@16 113 }}
Chris@16 114
Chris@16 115 #endif
Chris@16 116 #endif
Chris@16 117