]>
Commit | Line | Data |
---|---|---|
4569a895 AT |
1 | // -*- C++ -*- |
2 | ||
a5544970 | 3 | // Copyright (C) 2005-2019 Free Software Foundation, Inc. |
4569a895 AT |
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 | |
748086b7 | 8 | // Foundation; either version 3, or (at your option) any later |
4569a895 AT |
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 | ||
748086b7 JJ |
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. | |
4569a895 | 19 | |
748086b7 JJ |
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/>. | |
4569a895 AT |
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 | /** | |
a345e45d | 37 | * @file ov_tree_map_/traits.hpp |
4569a895 AT |
38 | * Contains an implementation class for ov_tree_. |
39 | */ | |
40 | ||
41 | #ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP | |
42 | #define PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP | |
43 | ||
44 | #include <ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp> | |
45 | ||
5e11f978 | 46 | namespace __gnu_pbds |
4569a895 AT |
47 | { |
48 | namespace detail | |
49 | { | |
a345e45d | 50 | /// Tree traits. |
30a96b3b | 51 | /// @ingroup traits |
4569a895 AT |
52 | template<typename Key, |
53 | typename Mapped, | |
54 | class Cmp_Fn, | |
a345e45d BK |
55 | template<typename Node_CItr, |
56 | class Node_Itr, | |
4569a895 | 57 | class Cmp_Fn_, |
a345e45d | 58 | typename _Alloc_> |
4569a895 | 59 | class Node_Update, |
a345e45d | 60 | typename _Alloc> |
4569a895 AT |
61 | struct tree_traits< |
62 | Key, | |
63 | Mapped, | |
64 | Cmp_Fn, | |
65 | Node_Update, | |
66 | ov_tree_tag, | |
a345e45d | 67 | _Alloc> |
4569a895 AT |
68 | { |
69 | private: | |
70 | typedef | |
71 | typename types_traits< | |
72 | Key, | |
73 | Mapped, | |
a345e45d | 74 | _Alloc, |
4569a895 AT |
75 | false>::value_type |
76 | value_type; | |
77 | ||
78 | public: | |
79 | typedef | |
a345e45d | 80 | typename tree_node_metadata_dispatch< |
4569a895 AT |
81 | Key, |
82 | Mapped, | |
83 | Cmp_Fn, | |
84 | Node_Update, | |
a345e45d | 85 | _Alloc>::type |
4569a895 AT |
86 | metadata_type; |
87 | ||
30a96b3b BK |
88 | /// This is an iterator to an iterator: it iterates over nodes, |
89 | /// and de-referencing it returns one of the tree's iterators. | |
4569a895 AT |
90 | typedef |
91 | ov_tree_node_const_it_< | |
92 | value_type, | |
93 | metadata_type, | |
a345e45d BK |
94 | _Alloc> |
95 | node_const_iterator; | |
4569a895 AT |
96 | |
97 | typedef | |
98 | ov_tree_node_it_< | |
99 | value_type, | |
100 | metadata_type, | |
a345e45d | 101 | _Alloc> |
4569a895 AT |
102 | node_iterator; |
103 | ||
104 | typedef | |
105 | Node_Update< | |
a345e45d | 106 | node_const_iterator, |
4569a895 AT |
107 | node_iterator, |
108 | Cmp_Fn, | |
a345e45d | 109 | _Alloc> |
4569a895 AT |
110 | node_update; |
111 | ||
112 | typedef | |
a345e45d BK |
113 | __gnu_pbds::null_node_update< |
114 | node_const_iterator, | |
4569a895 AT |
115 | node_iterator, |
116 | Cmp_Fn, | |
a345e45d | 117 | _Alloc>* |
4569a895 AT |
118 | null_node_update_pointer; |
119 | }; | |
120 | ||
30a96b3b | 121 | |
a345e45d | 122 | /// Specialization. |
30a96b3b | 123 | /// @ingroup traits |
4569a895 AT |
124 | template<typename Key, |
125 | class Cmp_Fn, | |
a345e45d BK |
126 | template<typename Node_CItr, |
127 | class Node_Itr, | |
4569a895 | 128 | class Cmp_Fn_, |
a345e45d | 129 | typename _Alloc_> |
4569a895 | 130 | class Node_Update, |
a345e45d | 131 | typename _Alloc> |
4569a895 AT |
132 | struct tree_traits< |
133 | Key, | |
a345e45d | 134 | null_type, |
4569a895 AT |
135 | Cmp_Fn, |
136 | Node_Update, | |
137 | ov_tree_tag, | |
a345e45d | 138 | _Alloc> |
4569a895 AT |
139 | { |
140 | private: | |
141 | typedef | |
142 | typename types_traits< | |
143 | Key, | |
a345e45d BK |
144 | null_type, |
145 | _Alloc, | |
4569a895 AT |
146 | false>::value_type |
147 | value_type; | |
148 | ||
149 | public: | |
150 | typedef | |
a345e45d | 151 | typename tree_node_metadata_dispatch< |
4569a895 | 152 | Key, |
a345e45d | 153 | null_type, |
4569a895 AT |
154 | Cmp_Fn, |
155 | Node_Update, | |
a345e45d | 156 | _Alloc>::type |
4569a895 AT |
157 | metadata_type; |
158 | ||
30a96b3b BK |
159 | /// This is an iterator to an iterator: it iterates over nodes, |
160 | /// and de-referencing it returns one of the tree's iterators. | |
4569a895 AT |
161 | typedef |
162 | ov_tree_node_const_it_< | |
163 | value_type, | |
164 | metadata_type, | |
a345e45d BK |
165 | _Alloc> |
166 | node_const_iterator; | |
4569a895 | 167 | |
a345e45d | 168 | typedef node_const_iterator node_iterator; |
4569a895 AT |
169 | |
170 | typedef | |
171 | Node_Update< | |
a345e45d BK |
172 | node_const_iterator, |
173 | node_const_iterator, | |
4569a895 | 174 | Cmp_Fn, |
a345e45d | 175 | _Alloc> |
4569a895 AT |
176 | node_update; |
177 | ||
178 | typedef | |
a345e45d BK |
179 | __gnu_pbds::null_node_update< |
180 | node_const_iterator, | |
4569a895 AT |
181 | node_iterator, |
182 | Cmp_Fn, | |
a345e45d | 183 | _Alloc>* |
4569a895 AT |
184 | null_node_update_pointer; |
185 | }; | |
4569a895 | 186 | } // namespace detail |
5e11f978 | 187 | } // namespace __gnu_pbds |
4569a895 AT |
188 | |
189 | #endif // #ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP | |
190 |