unordered_set_view.hpp 1.9 KB

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