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