synthesize.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #ifndef BOOST_FT_DETAIL_SYNTHESIZE_HPP_INCLUDED
  7. #define BOOST_FT_DETAIL_SYNTHESIZE_HPP_INCLUDED
  8. #include <cstddef>
  9. #include <boost/mpl/at.hpp>
  10. #include <boost/mpl/size.hpp>
  11. #include <boost/function_types/config/config.hpp>
  12. #include <boost/function_types/property_tags.hpp>
  13. #include <boost/function_types/detail/cv_traits.hpp>
  14. #include <boost/function_types/detail/retag_default_cc.hpp>
  15. namespace boost { namespace function_types { namespace detail {
  16. template<bits_t Flags, bits_t CCID, std::size_t Size>
  17. struct synthesize_impl_o
  18. {
  19. template<typename Seq> struct synthesize_impl_i { };
  20. };
  21. template<typename Seq, bits_t Bits>
  22. struct synthesize_impl
  23. : detail::synthesize_impl_o
  24. < ::boost::function_types::detail::decode_bits<Bits>::flags
  25. , ::boost::function_types::detail::decode_bits<Bits>::cc_id
  26. , ::boost::mpl::size<Seq>::value
  27. >
  28. ::template synthesize_impl_i<Seq>
  29. { };
  30. template<typename Seq, typename Tag>
  31. struct synthesize_func
  32. : detail::synthesize_impl
  33. < Seq
  34. , ::boost::function_types::detail::bits
  35. < detail::retag_default_cc
  36. < function_types::tag<nv_dcc_func, Tag> >
  37. >::value
  38. >
  39. { };
  40. template<typename Seq, typename Tag>
  41. struct synthesize_mfp
  42. : detail::synthesize_impl
  43. < Seq
  44. , ::boost::function_types::detail::bits
  45. < detail::retag_default_cc
  46. < function_types::tag
  47. < typename detail::cv_traits< typename mpl::at_c<Seq,1>::type >::tag
  48. , nv_dcc_mfp, Tag
  49. > >
  50. >::value
  51. >
  52. { };
  53. template<typename S, typename R = typename mpl::at_c<S,0>::type,
  54. typename C = typename mpl::at_c<S,1>::type>
  55. struct synthesize_mop
  56. {
  57. typedef R C::* type;
  58. };
  59. #define BOOST_FT_variations BOOST_FT_function|BOOST_FT_member_pointer
  60. #define BOOST_FT_al_path boost/function_types/detail/synthesize_impl
  61. #include <boost/function_types/detail/pp_loop.hpp>
  62. } } } // namespace ::boost::function_types::detail
  63. #endif