multiset_view.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 views/multiset_view.hpp
  9. /// \brief View of a bimap that is signature compatible with std::multiset.
  10. #ifndef BOOST_BIMAP_VIEWS_MULTISET_VIEW_HPP
  11. #define BOOST_BIMAP_VIEWS_MULTISET_VIEW_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/container_adaptor/multiset_adaptor.hpp>
  17. #include <boost/bimap/container_adaptor/detail/comparison_adaptor.hpp>
  18. #include <boost/bimap/detail/non_unique_views_helper.hpp>
  19. #include <boost/bimap/detail/set_view_base.hpp>
  20. namespace boost {
  21. namespace bimaps {
  22. namespace views {
  23. /// \brief View of a bimap that is signature compatible with std::multiset.
  24. /**
  25. This class uses container_adaptor and iterator_adaptor to wrapped a index of the
  26. multi_index bimap core so it can be used as a std::multiset.
  27. See also const_multiset_view.
  28. **/
  29. template< class CoreIndex >
  30. class multiset_view
  31. :
  32. public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
  33. multiset_adaptor,
  34. CoreIndex,
  35. reverse_iterator,
  36. const_reverse_iterator
  37. ),
  38. public ::boost::bimaps::detail::
  39. set_view_base< multiset_view< CoreIndex >, CoreIndex >
  40. {
  41. BOOST_BIMAP_SET_VIEW_BASE_FRIEND(multiset_view, CoreIndex)
  42. typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
  43. multiset_adaptor,
  44. CoreIndex,
  45. reverse_iterator,
  46. const_reverse_iterator
  47. ) base_;
  48. public:
  49. multiset_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) : base_(c) {}
  50. /*
  51. template< class LowerBounder, class UpperBounder >
  52. std::pair<BOOST_DEDUCED_TYPENAME base_::const_iterator,
  53. BOOST_DEDUCED_TYPENAME base_::const_iterator>
  54. range(LowerBounder lower,UpperBounder upper) const
  55. {
  56. return this->base().range(
  57. ::boost::bimaps::container_adaptor::detail::unary_check_adaptor
  58. <
  59. LowerBounder,
  60. BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
  61. BOOST_DEDUCED_TYPENAME base_::value_from_base
  62. >( lower, this->template functor<
  63. BOOST_DEDUCED_TYPENAME base_::value_from_base>() ),
  64. ::boost::bimaps::container_adaptor::detail::unary_check_adaptor
  65. <
  66. UpperBounder,
  67. BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
  68. BOOST_DEDUCED_TYPENAME base_::value_from_base
  69. >( upper, this->template functor<
  70. BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
  71. );
  72. }
  73. */
  74. multiset_view & operator=(const multiset_view & v)
  75. {
  76. this->base() = v.base(); return *this;
  77. }
  78. BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
  79. };
  80. } // namespace views
  81. } // namespace bimaps
  82. } // namespace boost
  83. #endif // BOOST_BIMAP_VIEWS_MULTISET_VIEW_HPP