is_tag_of_member_at.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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/support/is_tag_of_member_at.hpp
  9. /// \brief is_tag_of_member_at<tag,relation> metafunction
  10. #ifndef BOOST_BIMAP_RELATION_SUPPORT_IS_TAG_OF_MEMBER_AT_HPP
  11. #define BOOST_BIMAP_RELATION_SUPPORT_IS_TAG_OF_MEMBER_AT_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/relation/member_at.hpp>
  17. #include <boost/type_traits/is_same.hpp>
  18. #include <boost/mpl/bool.hpp>
  19. #include <boost/utility/enable_if.hpp>
  20. #include <boost/bimap/relation/support/member_with_tag.hpp>
  21. /** \struct boost::bimaps::relation::support::is_tag_of_member_at_left
  22. \brief Metafunction to test if a user tag is refering to the left member.
  23. \code
  24. template< class Tag, class Relation >
  25. struct is_tag_of_member_at_left : {true_|false_} {};
  26. \endcode
  27. This metafunction is somewhat redundant with member_with_tag, but it is included
  28. because it is a lot easier to metaprogram with it. The result type is the
  29. same that:
  30. \code
  31. is_same< member_with_tag<Tag,Relation>::type , member_at::left >::type
  32. \endcode
  33. See also member_with_tag, member_at, is_tag_of_member_at_right.
  34. \ingroup relation_group
  35. **/
  36. /** \struct boost::bimaps::relation::support::is_tag_of_member_at_right
  37. \brief Metafunction to test if a user tag is refering to the left member.
  38. \code
  39. template< class Tag, class Relation >
  40. struct is_tag_of_member_at_right : {true_|false_} {};
  41. \endcode
  42. This metafunction is somewhat redundat with member_with_tag, but it is included
  43. because it is a lot easier to metaprogram with it. The result type is the
  44. same that:
  45. \code
  46. is_same< member_with_tag<Tag,Relation>::type , member_at::right >::type
  47. \endcode
  48. See also member_with_tag, member_at, is_tag_of_member_at_left.
  49. \ingroup relation_group
  50. **/
  51. #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  52. namespace boost {
  53. namespace bimaps {
  54. namespace relation {
  55. namespace support {
  56. // Metafunction is_tag_of_member_at_left
  57. // Easiear metaprogramming
  58. template
  59. <
  60. class Tag,
  61. class Relation,
  62. class Enable = void
  63. >
  64. struct is_tag_of_member_at_left :
  65. ::boost::mpl::false_ {};
  66. template< class Tag, class Relation >
  67. struct is_tag_of_member_at_left
  68. <
  69. Tag, Relation,
  70. BOOST_DEDUCED_TYPENAME enable_if
  71. <
  72. is_same
  73. <
  74. BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
  75. member_at::left
  76. >
  77. >::type
  78. > :
  79. ::boost::mpl::true_ {};
  80. // Metafunction is_tag_of_member_at_right
  81. // Easiear metaprogramming
  82. template
  83. <
  84. class Tag,
  85. class Relation,
  86. class Enable = void
  87. >
  88. struct is_tag_of_member_at_right :
  89. ::boost::mpl::false_ {};
  90. template< class Tag, class Relation >
  91. struct is_tag_of_member_at_right
  92. <
  93. Tag, Relation,
  94. BOOST_DEDUCED_TYPENAME enable_if
  95. <
  96. is_same
  97. <
  98. BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
  99. member_at::right
  100. >
  101. >::type
  102. > :
  103. ::boost::mpl::true_ {};
  104. // Metafunction is_tag_of_member_at_info
  105. // Easiear metaprogramming
  106. template
  107. <
  108. class Tag,
  109. class Relation,
  110. class Enable = void
  111. >
  112. struct is_tag_of_member_at_info :
  113. ::boost::mpl::false_ {};
  114. template< class Tag, class Relation >
  115. struct is_tag_of_member_at_info
  116. <
  117. Tag, Relation,
  118. BOOST_DEDUCED_TYPENAME enable_if
  119. <
  120. is_same
  121. <
  122. BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
  123. member_at::info
  124. >
  125. >::type
  126. > :
  127. ::boost::mpl::true_ {};
  128. } // namespace support
  129. } // namespace relation
  130. } // namespace bimaps
  131. } // namespace boost
  132. #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  133. #endif // BOOST_BIMAP_RELATION_SUPPORT_IS_TAG_OF_MEMBER_AT_HPP