metadata_access_builder.hpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 relation/detail/metadata_access_builder.hpp
  9. /// \brief Define macros to help building metafunctions
  10. #ifndef BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
  11. #define BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
  17. #include <boost/bimap/detail/debug/static_error.hpp>
  18. #include <boost/utility/enable_if.hpp>
  19. #include <boost/preprocessor/cat.hpp>
  20. /******************************************************************************
  21. BIMAP SYMMETRIC METADATA ACCESS INTERFACE
  22. *******************************************************************************
  23. template< class Tag, class SymmetricType >
  24. struct NAME
  25. {
  26. typedef -unspecified- type;
  27. };
  28. ******************************************************************************/
  29. /*===========================================================================*/
  30. #define BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER( \
  31. \
  32. NAME, \
  33. METADATA_BY_LEFT, \
  34. METADATA_BY_RIGHT \
  35. ) \
  36. \
  37. template \
  38. < \
  39. class Tag, \
  40. class SymmetricType, \
  41. class Enable = void \
  42. > \
  43. struct NAME \
  44. { \
  45. BOOST_BIMAP_STATIC_ERROR( \
  46. BOOST_PP_CAT(NAME,_FAILURE), \
  47. (SymmetricType,Tag) \
  48. ); \
  49. }; \
  50. \
  51. template< class Tag, class SymmetricType > \
  52. struct NAME \
  53. < \
  54. Tag, SymmetricType, \
  55. BOOST_DEDUCED_TYPENAME enable_if \
  56. < \
  57. ::boost::bimaps::relation::support::is_tag_of_member_at_left \
  58. < \
  59. Tag, \
  60. SymmetricType \
  61. > \
  62. \
  63. >::type \
  64. > \
  65. { \
  66. typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_LEFT type; \
  67. }; \
  68. \
  69. template< class Tag, class SymmetricType > \
  70. struct NAME \
  71. < \
  72. Tag, SymmetricType, \
  73. BOOST_DEDUCED_TYPENAME enable_if \
  74. < \
  75. ::boost::bimaps::relation::support::is_tag_of_member_at_right \
  76. < \
  77. Tag, \
  78. SymmetricType \
  79. > \
  80. \
  81. >::type \
  82. > \
  83. { \
  84. typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_RIGHT type; \
  85. };
  86. /*===========================================================================*/
  87. #endif // BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCES_BUILDER_HPP