3 // Copyright (C) 2005-2019 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;
67 typedef rebind_traits<_Alloc, Node> node_alloc_traits;
73 bin_search_tree_const_it_<
74 typename node_alloc_traits::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 node_alloc_traits::pointer,
87 typename type_traits::value_type,
88 typename type_traits::pointer,
89 typename type_traits::const_pointer,
90 typename type_traits::reference,
91 typename type_traits::const_reference,
97 bin_search_tree_const_it_<
98 typename node_alloc_traits::pointer,
99 typename type_traits::value_type,
100 typename type_traits::pointer,
101 typename type_traits::const_pointer,
102 typename type_traits::reference,
103 typename type_traits::const_reference,
106 const_reverse_iterator;
110 typename node_alloc_traits::pointer,
111 typename type_traits::value_type,
112 typename type_traits::pointer,
113 typename type_traits::const_pointer,
114 typename type_traits::reference,
115 typename type_traits::const_reference,
120 /// This is an iterator to an iterator: it iterates over nodes,
121 /// and de-referencing it returns one of the tree's iterators.
123 bin_search_tree_const_node_it_<
125 point_const_iterator,
131 bin_search_tree_node_it_<
133 point_const_iterator,
147 __gnu_pbds::null_node_update<
152 null_node_update_pointer;
157 template<typename Key,
159 template<typename Node_CItr,
167 bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update, Node, _Alloc>
170 typedef types_traits<Key, null_type, _Alloc, false> type_traits;
171 typedef rebind_traits<_Alloc, Node> node_alloc_traits;
177 bin_search_tree_const_it_<
178 typename node_alloc_traits::pointer,
179 typename type_traits::value_type,
180 typename type_traits::pointer,
181 typename type_traits::const_pointer,
182 typename type_traits::reference,
183 typename type_traits::const_reference,
186 point_const_iterator;
188 typedef point_const_iterator point_iterator;
191 bin_search_tree_const_it_<
192 typename node_alloc_traits::pointer,
193 typename type_traits::value_type,
194 typename type_traits::pointer,
195 typename type_traits::const_pointer,
196 typename type_traits::reference,
197 typename type_traits::const_reference,
200 const_reverse_iterator;
202 typedef const_reverse_iterator reverse_iterator;
204 /// This is an iterator to an iterator: it iterates over nodes,
205 /// and de-referencing it returns one of the tree's iterators.
207 bin_search_tree_const_node_it_<
209 point_const_iterator,
214 typedef node_const_iterator node_iterator;
217 Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc>
221 __gnu_pbds::null_node_update<
226 null_node_update_pointer;
229 } // namespace detail
230 } // namespace __gnu_pbds
232 #endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP