concept_tags.hpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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/concept_tags.hpp
  9. /// \brief Bimap tags and concepts
  10. #ifndef BOOST_BIMAP_DETAIL_CONCEPT_TAGS_HPP
  11. #define BOOST_BIMAP_DETAIL_CONCEPT_TAGS_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/mpl/identity.hpp>
  17. #include <boost/mpl/placeholders.hpp>
  18. #include <boost/mpl/bool.hpp>
  19. namespace boost {
  20. namespace bimaps {
  21. namespace detail {
  22. /// \brief Tag of {SetType}_of definition classes
  23. /**
  24. The {SetType}_of classes are derived from this class so it is easy to construct
  25. metafunctions. For example now is easy to create a is_set_type_of metafunction.
  26. **/
  27. struct set_type_of_tag {};
  28. /// \brief Tag of {SetType}_of_relation defition classes
  29. struct set_type_of_relation_tag {};
  30. /// \brief Tag of {Side}_based identifiers
  31. struct side_based_tag : set_type_of_relation_tag {};
  32. } // namespace detail
  33. /** \struct boost::bimaps::left_based
  34. \brief Tag to indicate that the main view will be based on the left side.
  35. This is convenient because the multi-index core will be more efficient.
  36. If possible use this options or the right based one.
  37. See also right_based.
  38. **/
  39. /** \struct boost::bimaps::right_based
  40. \brief Tag to indicate that the main view will be based on the right side.
  41. This is convenient because the multi-index core will be more efficient.
  42. If possible use this options or the right based one.
  43. See also left_based.
  44. **/
  45. #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  46. struct left_based : ::boost::bimaps::detail::side_based_tag
  47. {
  48. // I run into troubles if I do not define bind for side based tags.
  49. // Maybe a more coherent way of binding the relation can be developped.
  50. template< class Relation > struct bind_to { typedef void type; };
  51. typedef mpl::bool_<true> left_mutable_key;
  52. typedef mpl::bool_<true> right_mutable_key;
  53. };
  54. struct right_based : ::boost::bimaps::detail::side_based_tag
  55. {
  56. // I run into troubles if I do not define bind for side based tags.
  57. // Maybe a more coherent way of binding the relation can be developped.
  58. template< class Relation > struct bind_to { typedef void type; };
  59. typedef mpl::bool_<true> left_mutable_key;
  60. typedef mpl::bool_<true> right_mutable_key;
  61. };
  62. #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  63. typedef mpl::_ _relation;
  64. } // namespace bimaps
  65. } // namespace boost
  66. #endif // BOOST_BIMAP_DETAIL_CONCEPT_TAGS_HPP