libstdc++
bin_search_tree_/traits.hpp
Go to the documentation of this file.
1// -*- C++ -*-
2
3// Copyright (C) 2005-2021 Free Software Foundation, Inc.
4//
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
9// version.
10
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.
15
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.
19
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/>.
24
25// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
26
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
34// warranty.
35
36/**
37 * @file bin_search_tree_/traits.hpp
38 * Contains an implementation for bin_search_tree_.
39 */
40
41#ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
42#define PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
43
46
47namespace __gnu_pbds
48{
49 namespace detail
50 {
51 /// Binary search tree traits, primary template
52 /// @ingroup traits
53 template<typename Key,
54 typename Mapped,
55 class Cmp_Fn,
56 template<typename Node_CItr,
57 class Node_Itr,
58 class _Cmp_Fn,
59 typename _Alloc>
60 class Node_Update,
61 class Node,
62 typename _Alloc>
64 {
65 private:
68
69 public:
70 typedef Node node;
71
72 typedef
74 typename node_alloc_traits::pointer,
76 typename type_traits::pointer,
77 typename type_traits::const_pointer,
78 typename type_traits::reference,
79 typename type_traits::const_reference,
80 true,
81 _Alloc>
83
84 typedef
86 typename node_alloc_traits::pointer,
88 typename type_traits::pointer,
89 typename type_traits::const_pointer,
90 typename type_traits::reference,
91 typename type_traits::const_reference,
92 true,
93 _Alloc>
95
96 typedef
98 typename node_alloc_traits::pointer,
100 typename type_traits::pointer,
101 typename type_traits::const_pointer,
102 typename type_traits::reference,
103 typename type_traits::const_reference,
104 false,
105 _Alloc>
107
108 typedef
110 typename node_alloc_traits::pointer,
112 typename type_traits::pointer,
113 typename type_traits::const_pointer,
114 typename type_traits::reference,
115 typename type_traits::const_reference,
116 false,
117 _Alloc>
119
120 /// This is an iterator to an iterator: it iterates over nodes,
121 /// and de-referencing it returns one of the tree's iterators.
122 typedef
124 Node,
127 _Alloc>
129
130 typedef
132 Node,
135 _Alloc>
137
138 typedef
139 Node_Update<
142 Cmp_Fn,
143 _Alloc>
144 node_update;
145
146 typedef
150 Cmp_Fn,
151 _Alloc>*
153 };
154
155 /// Specialization.
156 /// @ingroup traits
157 template<typename Key,
158 class Cmp_Fn,
159 template<typename Node_CItr,
160 class Node_Itr,
161 class _Cmp_Fn,
162 typename _Alloc>
163 class Node_Update,
164 class Node,
165 typename _Alloc>
166 struct
167 bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update, Node, _Alloc>
168 {
169 private:
172
173 public:
174 typedef Node node;
175
176 typedef
178 typename node_alloc_traits::pointer,
180 typename type_traits::pointer,
181 typename type_traits::const_pointer,
182 typename type_traits::reference,
183 typename type_traits::const_reference,
184 true,
185 _Alloc>
187
189
190 typedef
192 typename node_alloc_traits::pointer,
194 typename type_traits::pointer,
195 typename type_traits::const_pointer,
196 typename type_traits::reference,
197 typename type_traits::const_reference,
198 false,
199 _Alloc>
201
203
204 /// This is an iterator to an iterator: it iterates over nodes,
205 /// and de-referencing it returns one of the tree's iterators.
206 typedef
208 Node,
211 _Alloc>
213
215
216 typedef
217 Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc>
218 node_update;
219
220 typedef
224 Cmp_Fn,
225 _Alloc>*
227 };
228
229 } // namespace detail
230} // namespace __gnu_pbds
231
232#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
GNU extensions for policy-based data structures for public use.
Struct holding two objects of arbitrary type.
Definition: stl_pair.h:213
Represents no type, or absence of type, for template tricks.
A null node updator, indicating that no node updates are required.
Consistent API for accessing allocator-related types.
Traits for abstract types.
Binary search tree traits, primary template.
bin_search_tree_const_node_it_< Node, point_const_iterator, point_iterator, _Alloc > node_const_iterator
This is an iterator to an iterator: it iterates over nodes, and de-referencing it returns one of the ...
bin_search_tree_const_node_it_< Node, point_const_iterator, point_iterator, _Alloc > node_const_iterator
This is an iterator to an iterator: it iterates over nodes, and de-referencing it returns one of the ...