master.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // (C) Copyright Tobias Schwinger
  2. //
  3. // Use modification and distribution are subject to the boost Software License,
  4. // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  5. //------------------------------------------------------------------------------
  6. // no include guards, this file is intended for multiple inclusion
  7. #if BOOST_FT_ARITY_LOOP_PREFIX
  8. # ifndef BOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED
  9. # define BOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED
  10. # include <boost/preprocessor/cat.hpp>
  11. # include <boost/preprocessor/arithmetic/dec.hpp>
  12. # include <boost/preprocessor/iteration/local.hpp>
  13. # include <boost/preprocessor/facilities/empty.hpp>
  14. # include <boost/preprocessor/facilities/identity.hpp>
  15. # endif
  16. # define BOOST_FT_type_name type
  17. # ifdef BOOST_FT_flags
  18. # define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity)
  19. # define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity
  20. # else
  21. BOOST_PP_EXPAND(#) define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity)
  22. BOOST_PP_EXPAND(#) define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity
  23. # endif
  24. # define BOOST_FT_iter(i) BOOST_PP_CAT(iter_,i)
  25. #elif BOOST_FT_ARITY_LOOP_IS_ITERATING
  26. template< BOOST_FT_tplargs(BOOST_PP_IDENTITY(typename)) >
  27. struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,BOOST_FT_arity)
  28. {
  29. typedef BOOST_FT_type ;
  30. };
  31. template<>
  32. struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, BOOST_FT_n >
  33. {
  34. template<typename S> struct synthesize_impl_i
  35. {
  36. private:
  37. typedef typename mpl::begin<S>::type BOOST_FT_iter(0);
  38. # if BOOST_FT_n > 1
  39. # define BOOST_PP_LOCAL_MACRO(i) typedef typename mpl::next< \
  40. BOOST_FT_iter(BOOST_PP_DEC(i)) >::type BOOST_FT_iter(i);
  41. # define BOOST_PP_LOCAL_LIMITS (1,BOOST_FT_n-1)
  42. # include BOOST_PP_LOCAL_ITERATE()
  43. # endif
  44. public:
  45. typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,BOOST_FT_arity)
  46. < typename mpl::deref< BOOST_FT_iter(0) >::type
  47. # if BOOST_FT_mfp
  48. , typename detail::cv_traits<
  49. typename mpl::deref< BOOST_FT_iter(1) >::type >::type
  50. # endif
  51. # if BOOST_FT_n > (BOOST_FT_mfp+1)
  52. # define BOOST_PP_LOCAL_LIMITS (BOOST_FT_mfp+1,BOOST_FT_n-1)
  53. # define BOOST_PP_LOCAL_MACRO(i) \
  54. , typename mpl::deref< BOOST_FT_iter(i) >::type
  55. # include BOOST_PP_LOCAL_ITERATE()
  56. # endif
  57. >::type type;
  58. };
  59. };
  60. #elif BOOST_FT_ARITY_LOOP_SUFFIX
  61. # ifdef BOOST_FT_flags
  62. # undef BOOST_FT_make_type
  63. # undef BOOST_FT_make_type_impl
  64. # else
  65. BOOST_PP_EXPAND(#) undef BOOST_FT_make_type
  66. BOOST_PP_EXPAND(#) undef BOOST_FT_make_type_impl
  67. # endif
  68. # undef BOOST_FT_iter
  69. # undef BOOST_FT_type_name
  70. #else
  71. # error "attempt to use arity loop master file without loop"
  72. #endif