generate_index_binder.hpp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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_index_binder.hpp
  9. /// \brief Define macros to help building the set type of definitions
  10. #ifndef BOOST_BIMAP_DETAIL_GENERATE_INDEX_BINDER_HPP
  11. #define BOOST_BIMAP_DETAIL_GENERATE_INDEX_BINDER_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/multi_index/tag.hpp>
  17. /*===========================================================================*/
  18. #define BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP( \
  19. \
  20. MULTI_INDEX_TYPE \
  21. \
  22. ) \
  23. \
  24. template< class KeyExtractor, class Tag > \
  25. struct index_bind \
  26. { \
  27. typedef MULTI_INDEX_TYPE \
  28. < \
  29. multi_index::tag< Tag >, \
  30. KeyExtractor \
  31. \
  32. > type; \
  33. };
  34. /*===========================================================================*/
  35. /*===========================================================================*/
  36. #define BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP( \
  37. \
  38. MULTI_INDEX_TYPE, \
  39. CONFIG_PARAMETER \
  40. \
  41. ) \
  42. \
  43. template< class KeyExtractor, class Tag > \
  44. struct index_bind \
  45. { \
  46. typedef MULTI_INDEX_TYPE \
  47. < \
  48. multi_index::tag< Tag >, \
  49. KeyExtractor, \
  50. CONFIG_PARAMETER \
  51. \
  52. > type; \
  53. };
  54. /*===========================================================================*/
  55. /*===========================================================================*/
  56. #define BOOST_BIMAP_GENERATE_INDEX_BINDER_2CP( \
  57. \
  58. MULTI_INDEX_TYPE, \
  59. CONFIG_PARAMETER_1, \
  60. CONFIG_PARAMETER_2 \
  61. ) \
  62. \
  63. template< class KeyExtractor, class Tag > \
  64. struct index_bind \
  65. { \
  66. typedef MULTI_INDEX_TYPE \
  67. < \
  68. multi_index::tag< Tag >, \
  69. KeyExtractor, \
  70. CONFIG_PARAMETER_1, \
  71. CONFIG_PARAMETER_2 \
  72. \
  73. > type; \
  74. \
  75. };
  76. /*===========================================================================*/
  77. // This is a special registration to allow sequenced and random access indices
  78. // to play along smoothly with the other index types.
  79. /*===========================================================================*/
  80. #define BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP_NO_EXTRACTOR( \
  81. \
  82. MULTI_INDEX_TYPE \
  83. \
  84. ) \
  85. \
  86. template< class KeyExtractor, class Tag > \
  87. struct index_bind \
  88. { \
  89. typedef MULTI_INDEX_TYPE< multi_index::tag< Tag > > type; \
  90. };
  91. /*===========================================================================*/
  92. // This is yet another special registration to allow unconstrained sets
  93. // to play along smoothly with the other index types.
  94. /*===========================================================================*/
  95. #define BOOST_BIMAP_GENERATE_INDEX_BINDER_FAKE \
  96. \
  97. template< class KeyExtractor, class Tag > \
  98. struct index_bind \
  99. { \
  100. typedef void type; \
  101. }; \
  102. /*===========================================================================*/
  103. #endif // BOOST_BIMAP_DETAIL_GENERATE_INDEX_BINDER_HPP