PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/fusion/container/generation/make_map.hpp

http://hadesmem.googlecode.com/
C++ Header | 106 lines | 79 code | 16 blank | 11 comment | 0 complexity | 8990e6ebb81808240973e5d0ff77b4dc MD5 | raw file
  1/*=============================================================================
  2    Copyright (c) 2001-2006 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#ifndef BOOST_PP_IS_ITERATING
  8#if !defined(FUSION_MAKE_MAP_07222005_1247)
  9#define FUSION_MAKE_MAP_07222005_1247
 10
 11#include <boost/preprocessor/iterate.hpp>
 12#include <boost/preprocessor/repetition/enum_params.hpp>
 13#include <boost/preprocessor/repetition/enum_binary_params.hpp>
 14#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
 15#include <boost/preprocessor/repetition/repeat_from_to.hpp>
 16#include <boost/fusion/container/map/map.hpp>
 17#include <boost/fusion/support/detail/as_fusion_element.hpp>
 18#include <boost/fusion/support/pair.hpp>
 19
 20namespace boost { namespace fusion
 21{
 22    struct void_;
 23        
 24    namespace result_of
 25    {
 26        template <
 27            BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
 28                FUSION_MAX_VECTOR_SIZE, typename K, void_)
 29          , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
 30                FUSION_MAX_VECTOR_SIZE, typename D, void_)
 31          , typename Extra = void_
 32        >
 33        struct make_map;
 34            
 35        template <>
 36        struct make_map<>
 37        {
 38            typedef map<> type;
 39        };
 40    }
 41    
 42    inline map<>
 43    make_map()
 44    {
 45        return map<>();
 46    }
 47
 48#define BOOST_FUSION_PAIR(z, n, data)                                           \
 49    fusion::pair<                                                               \
 50        BOOST_PP_CAT(K, n)                                                      \
 51      , typename detail::as_fusion_element<BOOST_PP_CAT(D, n)>::type>
 52
 53#define BOOST_FUSION_MAKE_PAIR(z, n, data)                                      \
 54    fusion::make_pair<BOOST_PP_CAT(K, n)>(BOOST_PP_CAT(_, n))                   \
 55
 56#define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/make_map.hpp>
 57#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
 58#include BOOST_PP_ITERATE()
 59
 60#undef BOOST_FUSION_PAIR
 61#undef BOOST_FUSION_MAKE_PAIR
 62
 63}}
 64
 65#endif
 66#else // defined(BOOST_PP_IS_ITERATING)
 67///////////////////////////////////////////////////////////////////////////////
 68//
 69//  Preprocessor vertical repetition code
 70//
 71///////////////////////////////////////////////////////////////////////////////
 72
 73#define N BOOST_PP_ITERATION()
 74
 75    namespace result_of
 76    {
 77        template <
 78            BOOST_PP_ENUM_PARAMS(N, typename K)
 79          , BOOST_PP_ENUM_PARAMS(N, typename D)
 80        >
 81#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
 82         #define TEXT(z, n, text) , text
 83         struct make_map<BOOST_PP_ENUM_PARAMS(N, K), BOOST_PP_ENUM_PARAMS(N, D) BOOST_PP_REPEAT_FROM_TO(N, FUSION_MAX_VECTOR_SIZE, TEXT, void_) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_VECTOR_SIZE, TEXT, void_)>
 84         #undef TEXT
 85#else
 86        struct make_map<BOOST_PP_ENUM_PARAMS(N, K), BOOST_PP_ENUM_PARAMS(N, D)>
 87#endif
 88        {
 89            typedef map<BOOST_PP_ENUM(N, BOOST_FUSION_PAIR, _)> type;
 90        };
 91    }
 92
 93    template <
 94        BOOST_PP_ENUM_PARAMS(N, typename K)
 95      , BOOST_PP_ENUM_PARAMS(N, typename D)
 96    >
 97    inline map<BOOST_PP_ENUM(N, BOOST_FUSION_PAIR, _)>
 98    make_map(BOOST_PP_ENUM_BINARY_PARAMS(N, D, const& _))
 99    {
100        return map<BOOST_PP_ENUM(N, BOOST_FUSION_PAIR, _)>(
101            BOOST_PP_ENUM(N, BOOST_FUSION_MAKE_PAIR, _));
102    }
103
104#undef N
105#endif // defined(BOOST_PP_IS_ITERATING)
106