3 // Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3, or (at your option) any later
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
27 // Permission to use, copy, modify, sell, and distribute this software
28 // is hereby granted without fee, provided that the above copyright
29 // notice appears in all copies, and that both that copyright notice
30 // and this permission notice appear in supporting documentation. None
31 // of the above authors, nor IBM Haifa Research Laboratories, make any
32 // representation about the suitability of this software for any
33 // purpose. It is provided "as is" without express or implied
37 * @file bin_search_tree_/traits.hpp
38 * Contains an implementation for bin_search_tree_.
41 #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
42 #define PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
44 #include <ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp>
45 #include <ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp>
51 /// Binary search tree traits, primary template
53 template<typename Key,
56 template<typename Node_CItr,
63 struct bin_search_tree_traits
66 typedef types_traits<Key, Mapped, _Alloc, false> type_traits;
72 bin_search_tree_const_it_<
73 typename _Alloc::template rebind<
74 node>::other::pointer,
75 typename type_traits::value_type,
76 typename type_traits::pointer,
77 typename type_traits::const_pointer,
78 typename type_traits::reference,
79 typename type_traits::const_reference,
86 typename _Alloc::template rebind<
87 node>::other::pointer,
88 typename type_traits::value_type,
89 typename type_traits::pointer,
90 typename type_traits::const_pointer,
91 typename type_traits::reference,
92 typename type_traits::const_reference,
98 bin_search_tree_const_it_<
99 typename _Alloc::template rebind<
100 node>::other::pointer,
101 typename type_traits::value_type,
102 typename type_traits::pointer,
103 typename type_traits::const_pointer,
104 typename type_traits::reference,
105 typename type_traits::const_reference,
108 const_reverse_iterator;
112 typename _Alloc::template rebind<
113 node>::other::pointer,
114 typename type_traits::value_type,
115 typename type_traits::pointer,
116 typename type_traits::const_pointer,
117 typename type_traits::reference,
118 typename type_traits::const_reference,
123 /// This is an iterator to an iterator: it iterates over nodes,
124 /// and de-referencing it returns one of the tree's iterators.
126 bin_search_tree_const_node_it_<
128 point_const_iterator,
134 bin_search_tree_node_it_<
136 point_const_iterator,
150 __gnu_pbds::null_node_update<
155 null_node_update_pointer;
160 template<typename Key,
162 template<typename Node_CItr,
169 struct bin_search_tree_traits<
178 typedef types_traits<Key, null_type, _Alloc, false> type_traits;
184 bin_search_tree_const_it_<
185 typename _Alloc::template rebind<
186 node>::other::pointer,
187 typename type_traits::value_type,
188 typename type_traits::pointer,
189 typename type_traits::const_pointer,
190 typename type_traits::reference,
191 typename type_traits::const_reference,
194 point_const_iterator;
196 typedef point_const_iterator point_iterator;
199 bin_search_tree_const_it_<
200 typename _Alloc::template rebind<
201 node>::other::pointer,
202 typename type_traits::value_type,
203 typename type_traits::pointer,
204 typename type_traits::const_pointer,
205 typename type_traits::reference,
206 typename type_traits::const_reference,
209 const_reverse_iterator;
211 typedef const_reverse_iterator reverse_iterator;
213 /// This is an iterator to an iterator: it iterates over nodes,
214 /// and de-referencing it returns one of the tree's iterators.
216 bin_search_tree_const_node_it_<
218 point_const_iterator,
223 typedef node_const_iterator node_iterator;
226 Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc>
230 __gnu_pbds::null_node_update<
235 null_node_update_pointer;
238 } // namespace detail
239 } // namespace __gnu_pbds
241 #endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP