unordered_multiset_view.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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/unordered_multiset_view.hpp
  9. /// \brief View of a bimap that is signature compatible with tr1::unordered_multiset.
  10. #ifndef BOOST_BIMAP_VIEWS_UNORDERED_MULTISET_VIEW_HPP
  11. #define BOOST_BIMAP_VIEWS_UNORDERED_MULTISET_VIEW_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/container_adaptor/unordered_multiset_adaptor.hpp>
  17. #include <boost/bimap/detail/non_unique_views_helper.hpp>
  18. #include <boost/bimap/detail/set_view_base.hpp>
  19. namespace boost {
  20. namespace bimaps {
  21. namespace views {
  22. /// \brief View of a bimap that is signature compatible with std::unordered_multiset.
  23. /**
  24. This class uses container_adaptor and iterator_adaptor to wrapped a index of the
  25. multi_index bimap core so it can be used as a std::unordered_multiset.
  26. See also const_unordered_multiset_view.
  27. **/
  28. template< class CoreIndex >
  29. class unordered_multiset_view
  30. :
  31. public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
  32. unordered_multiset_adaptor,
  33. CoreIndex,
  34. local_iterator,
  35. const_local_iterator
  36. ),
  37. public ::boost::bimaps::detail::
  38. set_view_base< unordered_multiset_view< CoreIndex >, CoreIndex >
  39. {
  40. BOOST_BIMAP_SET_VIEW_BASE_FRIEND(unordered_multiset_view,CoreIndex)
  41. typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
  42. unordered_multiset_adaptor,
  43. CoreIndex,
  44. local_iterator,
  45. const_local_iterator
  46. ) base_;
  47. public:
  48. unordered_multiset_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
  49. : base_(c) {}
  50. BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
  51. unordered_multiset_view & operator=(const unordered_multiset_view & v)
  52. {
  53. this->base() = v.base();
  54. return *this;
  55. }
  56. };
  57. } // namespace views
  58. } // namespace bimaps
  59. } // namespace boost
  60. #endif // BOOST_BIMAP_VIEWS_UNORDERED_MULTISET_VIEW_HPP