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