Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:33:39

0001 /*=============================================================================
0002     Copyright (c) 2005-2013 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(BOOST_FUSION_BUILD_MAP_02042013_1448)
0008 #define BOOST_FUSION_BUILD_MAP_02042013_1448
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/iterator/equal_to.hpp>
0012 #include <boost/fusion/iterator/next.hpp>
0013 #include <boost/fusion/iterator/value_of.hpp>
0014 #include <boost/fusion/iterator/deref.hpp>
0015 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0016 #include <boost/fusion/sequence/intrinsic/end.hpp>
0017 #include <boost/fusion/container/map/map.hpp>
0018 #include <boost/fusion/algorithm/transformation/push_front.hpp>
0019 
0020 namespace boost { namespace fusion { namespace detail
0021 {
0022     template <typename First, typename Last, bool is_assoc
0023       , bool is_empty = result_of::equal_to<First, Last>::value
0024     >
0025     struct build_map;
0026 
0027     template <typename First, typename Last, bool is_assoc>
0028     struct build_map<First, Last, is_assoc, true>
0029     {
0030         typedef map<> type;
0031         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0032         static type
0033         call(First const&, Last const&)
0034         {
0035             return type();
0036         }
0037     };
0038 
0039     template <typename T, typename Rest>
0040     struct push_front_map;
0041 
0042     template <typename T, typename ...Rest>
0043     struct push_front_map<T, map<Rest...>>
0044     {
0045         typedef map<T, Rest...> type;
0046 
0047         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0048         static type
0049         call(T const& first, map<Rest...> const& rest)
0050         {
0051             return type(push_front(rest, first));
0052         }
0053     };
0054 
0055     template <typename First, typename Last, bool is_assoc>
0056     struct build_map<First, Last, is_assoc, false>
0057     {
0058         typedef
0059             build_map<typename result_of::next<First>::type, Last, is_assoc>
0060         next_build_map;
0061 
0062         typedef push_front_map<
0063             typename pair_from<First, is_assoc>::type
0064           , typename next_build_map::type>
0065         push_front;
0066 
0067         typedef typename push_front::type type;
0068 
0069         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0070         static type
0071         call(First const& f, Last const& l)
0072         {
0073             return push_front::call(
0074                 pair_from<First, is_assoc>::call(f)
0075               , next_build_map::call(fusion::next(f), l));
0076         }
0077     };
0078 }}}
0079 
0080 #endif