set_view.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/set_view.hpp
  9. /// \brief View of a bimap that is signature compatible with std::set.
  10. #ifndef BOOST_BIMAP_VIEWS_SET_VIEW_HPP
  11. #define BOOST_BIMAP_VIEWS_SET_VIEW_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/container_adaptor/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::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::set.
  25. See also const_set_view.
  26. **/
  27. template< class CoreIndex >
  28. class set_view
  29. :
  30. public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
  31. set_adaptor,
  32. CoreIndex,
  33. reverse_iterator, const_reverse_iterator
  34. ),
  35. public ::boost::bimaps::detail::
  36. set_view_base< set_view< CoreIndex >, CoreIndex >
  37. {
  38. typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
  39. set_adaptor,
  40. CoreIndex,
  41. reverse_iterator, const_reverse_iterator
  42. ) base_;
  43. BOOST_BIMAP_SET_VIEW_BASE_FRIEND(set_view,CoreIndex)
  44. public:
  45. set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) : base_(c) {}
  46. /*
  47. template< class LowerBounder, class UpperBounder >
  48. std::pair<BOOST_DEDUCED_TYPENAME base_::const_iterator,
  49. BOOST_DEDUCED_TYPENAME base_::const_iterator>
  50. range(LowerBounder lower,UpperBounder upper) const
  51. {
  52. return this->base().range(
  53. ::boost::bimaps::container_adaptor::detail::unary_check_adaptor
  54. <
  55. LowerBounder,
  56. BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
  57. BOOST_DEDUCED_TYPENAME base_::value_from_base
  58. >( lower, this->template functor<
  59. BOOST_DEDUCED_TYPENAME base_::value_from_base>() ),
  60. ::boost::bimaps::container_adaptor::detail::unary_check_adaptor
  61. <
  62. UpperBounder,
  63. BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
  64. BOOST_DEDUCED_TYPENAME base_::value_from_base
  65. >( upper, this->template functor<
  66. BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
  67. );
  68. }
  69. */
  70. set_view & operator=(const set_view & v)
  71. {
  72. this->base() = v.base();
  73. return *this;
  74. }
  75. };
  76. } // namespace views
  77. } // namespace bimaps
  78. } // namespace boost
  79. #endif // BOOST_BIMAP_VIEWS_SET_VIEW_HPP