multimap_adaptor.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 container_adaptor/multimap_adaptor.hpp
  9. /// \brief Container adaptor to easily build a std::multimap signature compatible container.
  10. #ifndef BOOST_BIMAP_CONTAINER_ADAPTOR_MULTIMAP_ADAPTOR_HPP
  11. #define BOOST_BIMAP_CONTAINER_ADAPTOR_MULTIMAP_ADAPTOR_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/container_adaptor/ordered_associative_container_adaptor.hpp>
  17. #include <boost/bimap/container_adaptor/detail/non_unique_container_helper.hpp>
  18. #include <boost/mpl/aux_/na.hpp>
  19. #include <boost/mpl/vector.hpp>
  20. namespace boost {
  21. namespace bimaps {
  22. namespace container_adaptor {
  23. /// \brief Container adaptor to easily build a std::multimap signature compatible container.
  24. template
  25. <
  26. class Base,
  27. class Iterator,
  28. class ConstIterator,
  29. class ReverseIterator,
  30. class ConstReverseIterator,
  31. class IteratorToBaseConverter = ::boost::mpl::na,
  32. class IteratorFromBaseConverter = ::boost::mpl::na,
  33. class ReverseIteratorFromBaseConverter = ::boost::mpl::na,
  34. class ValueToBaseConverter = ::boost::mpl::na,
  35. class ValueFromBaseConverter = ::boost::mpl::na,
  36. class KeyToBaseConverter = ::boost::mpl::na,
  37. class FunctorsFromDerivedClasses = mpl::vector<>
  38. >
  39. class multimap_adaptor :
  40. public ::boost::bimaps::container_adaptor::
  41. ordered_associative_container_adaptor
  42. <
  43. Base,
  44. Iterator, ConstIterator, ReverseIterator, ConstReverseIterator,
  45. BOOST_DEDUCED_TYPENAME Iterator::value_type::first_type,
  46. IteratorToBaseConverter, IteratorFromBaseConverter,
  47. ReverseIteratorFromBaseConverter,
  48. ValueToBaseConverter, ValueFromBaseConverter,
  49. KeyToBaseConverter,
  50. FunctorsFromDerivedClasses
  51. >
  52. {
  53. typedef ::boost::bimaps::container_adaptor::
  54. ordered_associative_container_adaptor
  55. <
  56. Base,
  57. Iterator, ConstIterator, ReverseIterator, ConstReverseIterator,
  58. BOOST_DEDUCED_TYPENAME Iterator::value_type::first_type,
  59. IteratorToBaseConverter, IteratorFromBaseConverter,
  60. ReverseIteratorFromBaseConverter,
  61. ValueToBaseConverter, ValueFromBaseConverter,
  62. KeyToBaseConverter,
  63. FunctorsFromDerivedClasses
  64. > base_;
  65. // MetaData -------------------------------------------------------------
  66. public:
  67. typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type;
  68. typedef data_type mapped_type;
  69. // Access -----------------------------------------------------------------
  70. public:
  71. explicit multimap_adaptor(Base & c) :
  72. base_(c) {}
  73. protected:
  74. typedef multimap_adaptor multimap_adaptor_;
  75. public:
  76. BOOST_BIMAP_NON_UNIQUE_CONTAINER_ADAPTOR_INSERT_FUNCTIONS
  77. };
  78. } // namespace container_adaptor
  79. } // namespace bimaps
  80. } // namespace boost
  81. #endif // BOOST_BIMAP_CONTAINER_ADAPTOR_MULTIMAP_ADAPTOR_HPP