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

http://hadesmem.googlecode.com/ · C++ Header · 93 lines · 67 code · 15 blank · 11 comment · 0 complexity · 7b54aae49c8476ba5af41ea8f5ca343b MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2001-2006 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #ifndef BOOST_PP_IS_ITERATING
  7. #if !defined(FUSION_MAKE_SET_09162005_1125)
  8. #define FUSION_MAKE_SET_09162005_1125
  9. #include <boost/preprocessor/iterate.hpp>
  10. #include <boost/preprocessor/repetition/enum_params.hpp>
  11. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  12. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  13. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  14. #include <boost/fusion/container/set/set.hpp>
  15. #include <boost/fusion/support/detail/as_fusion_element.hpp>
  16. #include <boost/fusion/support/pair.hpp>
  17. namespace boost { namespace fusion
  18. {
  19. struct void_;
  20. namespace result_of
  21. {
  22. template <
  23. BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
  24. FUSION_MAX_VECTOR_SIZE, typename T, void_)
  25. , typename Extra = void_
  26. >
  27. struct make_set;
  28. template <>
  29. struct make_set<>
  30. {
  31. typedef set<> type;
  32. };
  33. }
  34. inline set<>
  35. make_set()
  36. {
  37. return set<>();
  38. }
  39. #define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \
  40. typename detail::as_fusion_element<BOOST_PP_CAT(T, n)>::type
  41. #define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/make_set.hpp>
  42. #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
  43. #include BOOST_PP_ITERATE()
  44. #undef BOOST_FUSION_ELEMENT
  45. #undef BOOST_FUSION_AS_ELEMENT
  46. }}
  47. #endif
  48. #else // defined(BOOST_PP_IS_ITERATING)
  49. ///////////////////////////////////////////////////////////////////////////////
  50. //
  51. // Preprocessor vertical repetition code
  52. //
  53. ///////////////////////////////////////////////////////////////////////////////
  54. #define N BOOST_PP_ITERATION()
  55. namespace result_of
  56. {
  57. template <BOOST_PP_ENUM_PARAMS(N, typename T)>
  58. #if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
  59. #define TEXT(z, n, text) , text
  60. struct make_set< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_SET_SIZE, TEXT, void_) >
  61. #undef TEXT
  62. #else
  63. struct make_set<BOOST_PP_ENUM_PARAMS(N, T)>
  64. #endif
  65. {
  66. typedef set<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
  67. };
  68. }
  69. template <BOOST_PP_ENUM_PARAMS(N, typename T)>
  70. inline set<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
  71. make_set(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
  72. {
  73. return set<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
  74. BOOST_PP_ENUM_PARAMS(N, _));
  75. }
  76. #undef N
  77. #endif // defined(BOOST_PP_IS_ITERATING)