generate_relation_binder.hpp 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Boost.Bimap
  2. //
  3. // Copyright (c) 2006-2007 Matias Capeletto
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. /// \file detail/generate_relation_binder.hpp
  9. /// \brief Define macros to help building the set type of definitions
  10. #ifndef BOOST_BIMAP_DETAIL_GENERATE_RELATION_BINDER_HPP
  11. #define BOOST_BIMAP_DETAIL_GENERATE_RELATION_BINDER_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/mpl/apply.hpp>
  17. /*===========================================================================*/
  18. #define BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP( \
  19. \
  20. SET_TYPE_OF \
  21. ) \
  22. \
  23. template< class Relation > \
  24. struct bind_to \
  25. { \
  26. typedef SET_TYPE_OF<Relation> type; \
  27. \
  28. };
  29. /*===========================================================================*/
  30. /*===========================================================================*/
  31. #define BOOST_BIMAP_GENERATE_RELATION_BINDER_1CP( \
  32. \
  33. SET_TYPE_OF, \
  34. CP1 \
  35. ) \
  36. \
  37. template< class Relation > \
  38. struct bind_to \
  39. { \
  40. typedef SET_TYPE_OF \
  41. < \
  42. Relation, \
  43. BOOST_DEDUCED_TYPENAME mpl::apply<CP1, \
  44. BOOST_DEDUCED_TYPENAME Relation::storage_base >::type \
  45. \
  46. > type; \
  47. \
  48. };
  49. /*===========================================================================*/
  50. /*===========================================================================*/
  51. #define BOOST_BIMAP_GENERATE_RELATION_BINDER_2CP( \
  52. \
  53. SET_TYPE_OF, \
  54. CP1, \
  55. CP2 \
  56. ) \
  57. \
  58. template< class Relation > \
  59. struct bind_to \
  60. { \
  61. typedef SET_TYPE_OF \
  62. < \
  63. Relation, \
  64. BOOST_DEDUCED_TYPENAME mpl::apply<CP1, \
  65. BOOST_DEDUCED_TYPENAME Relation::storage_base >::type, \
  66. BOOST_DEDUCED_TYPENAME mpl::apply<CP2, \
  67. BOOST_DEDUCED_TYPENAME Relation::storage_base >::type \
  68. \
  69. > type; \
  70. \
  71. };
  72. /*===========================================================================*/
  73. #endif // BOOST_BIMAP_DETAIL_GENERATE_RELATION_BINDER_HPP