annotate gcc/ada/libgnat/a-cofuma.ads @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT LIBRARY COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- ADA.CONTAINERS.FUNCTIONAL_MAPS --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 2016-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- This specification is derived from the Ada Reference Manual for use with --
kono
parents:
diff changeset
12 -- GNAT. The copyright notice above, and the license provisions that follow --
kono
parents:
diff changeset
13 -- apply solely to the contents of the part following the private keyword. --
kono
parents:
diff changeset
14 -- --
kono
parents:
diff changeset
15 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
16 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
23 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
24 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
25 -- --
kono
parents:
diff changeset
26 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
27 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
29 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 pragma Ada_2012;
kono
parents:
diff changeset
33 private with Ada.Containers.Functional_Base;
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 generic
kono
parents:
diff changeset
36 type Key_Type (<>) is private;
kono
parents:
diff changeset
37 type Element_Type (<>) is private;
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 with function Equivalent_Keys
kono
parents:
diff changeset
40 (Left : Key_Type;
kono
parents:
diff changeset
41 Right : Key_Type) return Boolean is "=";
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
42 with function "=" (Left, Right : Element_Type) return Boolean is <>;
111
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 Enable_Handling_Of_Equivalence : Boolean := True;
kono
parents:
diff changeset
45 -- This constant should only be set to False when no particular handling
kono
parents:
diff changeset
46 -- of equivalence over keys is needed, that is, Equivalent_Keys defines a
kono
parents:
diff changeset
47 -- key uniquely.
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 package Ada.Containers.Functional_Maps with SPARK_Mode is
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 type Map is private with
kono
parents:
diff changeset
52 Default_Initial_Condition => Is_Empty (Map) and Length (Map) = 0,
kono
parents:
diff changeset
53 Iterable => (First => Iter_First,
kono
parents:
diff changeset
54 Next => Iter_Next,
kono
parents:
diff changeset
55 Has_Element => Iter_Has_Element,
kono
parents:
diff changeset
56 Element => Iter_Element);
kono
parents:
diff changeset
57 -- Maps are empty when default initialized.
kono
parents:
diff changeset
58 -- "For in" quantification over maps should not be used.
kono
parents:
diff changeset
59 -- "For of" quantification over maps iterates over keys.
kono
parents:
diff changeset
60 -- Note that, for proof, "for of" quantification is understood modulo
kono
parents:
diff changeset
61 -- equivalence (the range of quantification comprises all the keys that are
kono
parents:
diff changeset
62 -- equivalent to any key of the map).
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 -----------------------
kono
parents:
diff changeset
65 -- Basic operations --
kono
parents:
diff changeset
66 -----------------------
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 -- Maps are axiomatized using Has_Key and Get, encoding respectively the
kono
parents:
diff changeset
69 -- presence of a key in a map and an accessor to elements associated with
kono
parents:
diff changeset
70 -- its keys. The length of a map is also added to protect Add against
kono
parents:
diff changeset
71 -- overflows but it is not actually modeled.
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 function Has_Key (Container : Map; Key : Key_Type) return Boolean with
kono
parents:
diff changeset
74 -- Return True if Key is present in Container
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 Global => null,
kono
parents:
diff changeset
77 Post =>
kono
parents:
diff changeset
78 (if Enable_Handling_Of_Equivalence then
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 -- Has_Key returns the same result on all equivalent keys
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 (if (for some K of Container => Equivalent_Keys (K, Key)) then
kono
parents:
diff changeset
83 Has_Key'Result));
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 function Get (Container : Map; Key : Key_Type) return Element_Type with
kono
parents:
diff changeset
86 -- Return the element associated with Key in Container
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 Global => null,
kono
parents:
diff changeset
89 Pre => Has_Key (Container, Key),
kono
parents:
diff changeset
90 Post =>
kono
parents:
diff changeset
91 (if Enable_Handling_Of_Equivalence then
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 -- Get returns the same result on all equivalent keys
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 Get'Result = W_Get (Container, Witness (Container, Key))
kono
parents:
diff changeset
96 and (for all K of Container =>
kono
parents:
diff changeset
97 (Equivalent_Keys (K, Key) =
kono
parents:
diff changeset
98 (Witness (Container, Key) = Witness (Container, K)))));
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 function Length (Container : Map) return Count_Type with
kono
parents:
diff changeset
101 Global => null;
kono
parents:
diff changeset
102 -- Return the number of mappings in Container
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 ------------------------
kono
parents:
diff changeset
105 -- Property Functions --
kono
parents:
diff changeset
106 ------------------------
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 function "<=" (Left : Map; Right : Map) return Boolean with
kono
parents:
diff changeset
109 -- Map inclusion
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 Global => null,
kono
parents:
diff changeset
112 Post =>
kono
parents:
diff changeset
113 "<="'Result =
kono
parents:
diff changeset
114 (for all Key of Left =>
kono
parents:
diff changeset
115 Has_Key (Right, Key) and then Get (Right, Key) = Get (Left, Key));
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 function "=" (Left : Map; Right : Map) return Boolean with
kono
parents:
diff changeset
118 -- Extensional equality over maps
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 Global => null,
kono
parents:
diff changeset
121 Post =>
kono
parents:
diff changeset
122 "="'Result =
kono
parents:
diff changeset
123 ((for all Key of Left =>
kono
parents:
diff changeset
124 Has_Key (Right, Key)
kono
parents:
diff changeset
125 and then Get (Right, Key) = Get (Left, Key))
kono
parents:
diff changeset
126 and (for all Key of Right => Has_Key (Left, Key)));
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 pragma Warnings (Off, "unused variable ""Key""");
kono
parents:
diff changeset
129 function Is_Empty (Container : Map) return Boolean with
kono
parents:
diff changeset
130 -- A map is empty if it contains no key
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 Global => null,
kono
parents:
diff changeset
133 Post => Is_Empty'Result = (for all Key of Container => False);
kono
parents:
diff changeset
134 pragma Warnings (On, "unused variable ""Key""");
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 function Keys_Included (Left : Map; Right : Map) return Boolean
kono
parents:
diff changeset
137 -- Returns True if every Key of Left is in Right
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 with
kono
parents:
diff changeset
140 Global => null,
kono
parents:
diff changeset
141 Post =>
kono
parents:
diff changeset
142 Keys_Included'Result = (for all Key of Left => Has_Key (Right, Key));
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 function Same_Keys (Left : Map; Right : Map) return Boolean
kono
parents:
diff changeset
145 -- Returns True if Left and Right have the same keys
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 with
kono
parents:
diff changeset
148 Global => null,
kono
parents:
diff changeset
149 Post =>
kono
parents:
diff changeset
150 Same_Keys'Result =
kono
parents:
diff changeset
151 (Keys_Included (Left, Right)
kono
parents:
diff changeset
152 and Keys_Included (Left => Right, Right => Left));
kono
parents:
diff changeset
153 pragma Annotate (GNATprove, Inline_For_Proof, Same_Keys);
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 function Keys_Included_Except
kono
parents:
diff changeset
156 (Left : Map;
kono
parents:
diff changeset
157 Right : Map;
kono
parents:
diff changeset
158 New_Key : Key_Type) return Boolean
kono
parents:
diff changeset
159 -- Returns True if Left contains only keys of Right and possibly New_Key
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 with
kono
parents:
diff changeset
162 Global => null,
kono
parents:
diff changeset
163 Post =>
kono
parents:
diff changeset
164 Keys_Included_Except'Result =
kono
parents:
diff changeset
165 (for all Key of Left =>
kono
parents:
diff changeset
166 (if not Equivalent_Keys (Key, New_Key) then
kono
parents:
diff changeset
167 Has_Key (Right, Key)));
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 function Keys_Included_Except
kono
parents:
diff changeset
170 (Left : Map;
kono
parents:
diff changeset
171 Right : Map;
kono
parents:
diff changeset
172 X : Key_Type;
kono
parents:
diff changeset
173 Y : Key_Type) return Boolean
kono
parents:
diff changeset
174 -- Returns True if Left contains only keys of Right and possibly X and Y
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 with
kono
parents:
diff changeset
177 Global => null,
kono
parents:
diff changeset
178 Post =>
kono
parents:
diff changeset
179 Keys_Included_Except'Result =
kono
parents:
diff changeset
180 (for all Key of Left =>
kono
parents:
diff changeset
181 (if not Equivalent_Keys (Key, X)
kono
parents:
diff changeset
182 and not Equivalent_Keys (Key, Y)
kono
parents:
diff changeset
183 then
kono
parents:
diff changeset
184 Has_Key (Right, Key)));
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 function Elements_Equal_Except
kono
parents:
diff changeset
187 (Left : Map;
kono
parents:
diff changeset
188 Right : Map;
kono
parents:
diff changeset
189 New_Key : Key_Type) return Boolean
kono
parents:
diff changeset
190 -- Returns True if all the keys of Left are mapped to the same elements in
kono
parents:
diff changeset
191 -- Left and Right except New_Key.
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193 with
kono
parents:
diff changeset
194 Global => null,
kono
parents:
diff changeset
195 Post =>
kono
parents:
diff changeset
196 Elements_Equal_Except'Result =
kono
parents:
diff changeset
197 (for all Key of Left =>
kono
parents:
diff changeset
198 (if not Equivalent_Keys (Key, New_Key) then
kono
parents:
diff changeset
199 Has_Key (Right, Key)
kono
parents:
diff changeset
200 and then Get (Left, Key) = Get (Right, Key)));
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 function Elements_Equal_Except
kono
parents:
diff changeset
203 (Left : Map;
kono
parents:
diff changeset
204 Right : Map;
kono
parents:
diff changeset
205 X : Key_Type;
kono
parents:
diff changeset
206 Y : Key_Type) return Boolean
kono
parents:
diff changeset
207 -- Returns True if all the keys of Left are mapped to the same elements in
kono
parents:
diff changeset
208 -- Left and Right except X and Y.
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 with
kono
parents:
diff changeset
211 Global => null,
kono
parents:
diff changeset
212 Post =>
kono
parents:
diff changeset
213 Elements_Equal_Except'Result =
kono
parents:
diff changeset
214 (for all Key of Left =>
kono
parents:
diff changeset
215 (if not Equivalent_Keys (Key, X)
kono
parents:
diff changeset
216 and not Equivalent_Keys (Key, Y)
kono
parents:
diff changeset
217 then
kono
parents:
diff changeset
218 Has_Key (Right, Key)
kono
parents:
diff changeset
219 and then Get (Left, Key) = Get (Right, Key)));
kono
parents:
diff changeset
220
kono
parents:
diff changeset
221 ----------------------------
kono
parents:
diff changeset
222 -- Construction Functions --
kono
parents:
diff changeset
223 ----------------------------
kono
parents:
diff changeset
224
kono
parents:
diff changeset
225 -- For better efficiency of both proofs and execution, avoid using
kono
parents:
diff changeset
226 -- construction functions in annotations and rather use property functions.
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 function Add
kono
parents:
diff changeset
229 (Container : Map;
kono
parents:
diff changeset
230 New_Key : Key_Type;
kono
parents:
diff changeset
231 New_Item : Element_Type) return Map
kono
parents:
diff changeset
232 -- Returns Container augmented with the mapping Key -> New_Item
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 with
kono
parents:
diff changeset
235 Global => null,
kono
parents:
diff changeset
236 Pre =>
kono
parents:
diff changeset
237 not Has_Key (Container, New_Key)
kono
parents:
diff changeset
238 and Length (Container) < Count_Type'Last,
kono
parents:
diff changeset
239 Post =>
kono
parents:
diff changeset
240 Length (Container) + 1 = Length (Add'Result)
kono
parents:
diff changeset
241 and Has_Key (Add'Result, New_Key)
kono
parents:
diff changeset
242 and Get (Add'Result, New_Key) = New_Item
kono
parents:
diff changeset
243 and Container <= Add'Result
kono
parents:
diff changeset
244 and Keys_Included_Except (Add'Result, Container, New_Key);
kono
parents:
diff changeset
245
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
246 function Remove
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
247 (Container : Map;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
248 Key : Key_Type) return Map
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
249 -- Returns Container without any mapping for Key
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
250
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
251 with
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
252 Global => null,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
253 Pre => Has_Key (Container, Key),
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
254 Post =>
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
255 Length (Container) = Length (Remove'Result) + 1
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
256 and not Has_Key (Remove'Result, Key)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
257 and Remove'Result <= Container
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
258 and Keys_Included_Except (Container, Remove'Result, Key);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
259
111
kono
parents:
diff changeset
260 function Set
kono
parents:
diff changeset
261 (Container : Map;
kono
parents:
diff changeset
262 Key : Key_Type;
kono
parents:
diff changeset
263 New_Item : Element_Type) return Map
kono
parents:
diff changeset
264 -- Returns Container, where the element associated with Key has been
kono
parents:
diff changeset
265 -- replaced by New_Item.
kono
parents:
diff changeset
266
kono
parents:
diff changeset
267 with
kono
parents:
diff changeset
268 Global => null,
kono
parents:
diff changeset
269 Pre => Has_Key (Container, Key),
kono
parents:
diff changeset
270 Post =>
kono
parents:
diff changeset
271 Length (Container) = Length (Set'Result)
kono
parents:
diff changeset
272 and Get (Set'Result, Key) = New_Item
kono
parents:
diff changeset
273 and Same_Keys (Container, Set'Result)
kono
parents:
diff changeset
274 and Elements_Equal_Except (Container, Set'Result, Key);
kono
parents:
diff changeset
275
kono
parents:
diff changeset
276 ------------------------------
kono
parents:
diff changeset
277 -- Handling of Equivalence --
kono
parents:
diff changeset
278 ------------------------------
kono
parents:
diff changeset
279
kono
parents:
diff changeset
280 -- These functions are used to specify that Get returns the same value on
kono
parents:
diff changeset
281 -- equivalent keys. They should not be used directly in user code.
kono
parents:
diff changeset
282
kono
parents:
diff changeset
283 function Has_Witness (Container : Map; Witness : Count_Type) return Boolean
kono
parents:
diff changeset
284 with
kono
parents:
diff changeset
285 Ghost,
kono
parents:
diff changeset
286 Global => null;
kono
parents:
diff changeset
287 -- Returns True if there is a key with witness Witness in Container
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 function Witness (Container : Map; Key : Key_Type) return Count_Type with
kono
parents:
diff changeset
290 -- Returns the witness of Key in Container
kono
parents:
diff changeset
291
kono
parents:
diff changeset
292 Ghost,
kono
parents:
diff changeset
293 Global => null,
kono
parents:
diff changeset
294 Pre => Has_Key (Container, Key),
kono
parents:
diff changeset
295 Post => Has_Witness (Container, Witness'Result);
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 function W_Get (Container : Map; Witness : Count_Type) return Element_Type
kono
parents:
diff changeset
298 with
kono
parents:
diff changeset
299 -- Returns the element associated with a witness in Container
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 Ghost,
kono
parents:
diff changeset
302 Global => null,
kono
parents:
diff changeset
303 Pre => Has_Witness (Container, Witness);
kono
parents:
diff changeset
304
kono
parents:
diff changeset
305 ---------------------------
kono
parents:
diff changeset
306 -- Iteration Primitives --
kono
parents:
diff changeset
307 ---------------------------
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309 type Private_Key is private;
kono
parents:
diff changeset
310
kono
parents:
diff changeset
311 function Iter_First (Container : Map) return Private_Key with
kono
parents:
diff changeset
312 Global => null;
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314 function Iter_Has_Element
kono
parents:
diff changeset
315 (Container : Map;
kono
parents:
diff changeset
316 Key : Private_Key) return Boolean
kono
parents:
diff changeset
317 with
kono
parents:
diff changeset
318 Global => null;
kono
parents:
diff changeset
319
kono
parents:
diff changeset
320 function Iter_Next (Container : Map; Key : Private_Key) return Private_Key
kono
parents:
diff changeset
321 with
kono
parents:
diff changeset
322 Global => null,
kono
parents:
diff changeset
323 Pre => Iter_Has_Element (Container, Key);
kono
parents:
diff changeset
324
kono
parents:
diff changeset
325 function Iter_Element (Container : Map; Key : Private_Key) return Key_Type
kono
parents:
diff changeset
326 with
kono
parents:
diff changeset
327 Global => null,
kono
parents:
diff changeset
328 Pre => Iter_Has_Element (Container, Key);
kono
parents:
diff changeset
329 pragma Annotate (GNATprove, Iterable_For_Proof, "Contains", Has_Key);
kono
parents:
diff changeset
330
kono
parents:
diff changeset
331 private
kono
parents:
diff changeset
332
kono
parents:
diff changeset
333 pragma SPARK_Mode (Off);
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 function "="
kono
parents:
diff changeset
336 (Left : Key_Type;
kono
parents:
diff changeset
337 Right : Key_Type) return Boolean renames Equivalent_Keys;
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 subtype Positive_Count_Type is Count_Type range 1 .. Count_Type'Last;
kono
parents:
diff changeset
340
kono
parents:
diff changeset
341 package Element_Containers is new Ada.Containers.Functional_Base
kono
parents:
diff changeset
342 (Element_Type => Element_Type,
kono
parents:
diff changeset
343 Index_Type => Positive_Count_Type);
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 package Key_Containers is new Ada.Containers.Functional_Base
kono
parents:
diff changeset
346 (Element_Type => Key_Type,
kono
parents:
diff changeset
347 Index_Type => Positive_Count_Type);
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 type Map is record
kono
parents:
diff changeset
350 Keys : Key_Containers.Container;
kono
parents:
diff changeset
351 Elements : Element_Containers.Container;
kono
parents:
diff changeset
352 end record;
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 type Private_Key is new Count_Type;
kono
parents:
diff changeset
355
kono
parents:
diff changeset
356 function Iter_First (Container : Map) return Private_Key is (1);
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 function Iter_Has_Element
kono
parents:
diff changeset
359 (Container : Map;
kono
parents:
diff changeset
360 Key : Private_Key) return Boolean
kono
parents:
diff changeset
361 is
kono
parents:
diff changeset
362 (Count_Type (Key) in 1 .. Key_Containers.Length (Container.Keys));
kono
parents:
diff changeset
363
kono
parents:
diff changeset
364 function Iter_Next
kono
parents:
diff changeset
365 (Container : Map;
kono
parents:
diff changeset
366 Key : Private_Key) return Private_Key
kono
parents:
diff changeset
367 is
kono
parents:
diff changeset
368 (if Key = Private_Key'Last then 0 else Key + 1);
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 function Iter_Element
kono
parents:
diff changeset
371 (Container : Map;
kono
parents:
diff changeset
372 Key : Private_Key) return Key_Type
kono
parents:
diff changeset
373 is
kono
parents:
diff changeset
374 (Key_Containers.Get (Container.Keys, Count_Type (Key)));
kono
parents:
diff changeset
375
kono
parents:
diff changeset
376 end Ada.Containers.Functional_Maps;