static_access_builder.hpp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/static_access_builder.hpp
  9. /// \brief Define macros to help building metafunctions
  10. #ifndef BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCESS_BUILDER_HPP
  11. #define BOOST_BIMAP_RELATION_DETAIL_STATIC_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 STATIC ACCESS INTERFACE
  22. *******************************************************************************
  23. template< class Tag, class SYMETRIC_TYPE >
  24. struct NAME
  25. {
  26. -UNDEFINED BODY-;
  27. };
  28. ******************************************************************************/
  29. /*===========================================================================*/
  30. #define BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER( \
  31. \
  32. NAME, \
  33. SYMMETRIC_TYPE, \
  34. LEFT_BODY, \
  35. RIGHT_BODY \
  36. ) \
  37. \
  38. template \
  39. < \
  40. class Tag, \
  41. class SYMMETRIC_TYPE, \
  42. class Enable = void \
  43. > \
  44. struct NAME \
  45. { \
  46. BOOST_BIMAP_STATIC_ERROR( \
  47. BOOST_PP_CAT(NAME,_FAILURE), \
  48. (SYMMETRIC_TYPE,Tag) \
  49. ); \
  50. }; \
  51. \
  52. template< class Tag, class SYMMETRIC_TYPE > \
  53. struct NAME \
  54. < \
  55. Tag, SYMMETRIC_TYPE, \
  56. BOOST_DEDUCED_TYPENAME enable_if \
  57. < \
  58. ::boost::bimaps::relation::support::is_tag_of_member_at_left \
  59. < \
  60. Tag, \
  61. SYMMETRIC_TYPE \
  62. > \
  63. \
  64. >::type \
  65. > \
  66. { \
  67. LEFT_BODY; \
  68. }; \
  69. \
  70. template< class Tag, class SYMMETRIC_TYPE > \
  71. struct NAME \
  72. < \
  73. Tag, SYMMETRIC_TYPE, \
  74. BOOST_DEDUCED_TYPENAME enable_if \
  75. < \
  76. ::boost::bimaps::relation::support::is_tag_of_member_at_right \
  77. < \
  78. Tag, \
  79. SYMMETRIC_TYPE \
  80. > \
  81. \
  82. >::type \
  83. > \
  84. { \
  85. RIGHT_BODY; \
  86. };
  87. /*===========================================================================*/
  88. #endif // BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCES_BUILDER_HPP