PR tree-optimization/19853
[official-gcc.git] / gcc / ada / a-coorma.adb
blob2a706ab4d59e45f6b9b9756ada3636284c76fc85
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- ADA.CONTAINERS.ORDERED_MAPS --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2004 Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, USA. --
25 -- --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
32 -- --
33 -- This unit was originally developed by Matthew J Heaney. --
34 ------------------------------------------------------------------------------
36 with Ada.Unchecked_Deallocation;
38 with Ada.Containers.Red_Black_Trees.Generic_Operations;
39 pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Operations);
41 with Ada.Containers.Red_Black_Trees.Generic_Keys;
42 pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
44 with System; use type System.Address;
46 package body Ada.Containers.Ordered_Maps is
48 use Red_Black_Trees;
50 type Node_Type is limited record
51 Parent : Node_Access;
52 Left : Node_Access;
53 Right : Node_Access;
54 Color : Red_Black_Trees.Color_Type := Red;
55 Key : Key_Type;
56 Element : Element_Type;
57 end record;
59 -----------------------------
60 -- Node Access Subprograms --
61 -----------------------------
63 -- These subprograms provide a functional interface to access fields
64 -- of a node, and a procedural interface for modifying these values.
66 function Color (Node : Node_Access) return Color_Type;
67 pragma Inline (Color);
69 function Left (Node : Node_Access) return Node_Access;
70 pragma Inline (Left);
72 function Parent (Node : Node_Access) return Node_Access;
73 pragma Inline (Parent);
75 function Right (Node : Node_Access) return Node_Access;
76 pragma Inline (Right);
78 procedure Set_Parent (Node : Node_Access; Parent : Node_Access);
79 pragma Inline (Set_Parent);
81 procedure Set_Left (Node : Node_Access; Left : Node_Access);
82 pragma Inline (Set_Left);
84 procedure Set_Right (Node : Node_Access; Right : Node_Access);
85 pragma Inline (Set_Right);
87 procedure Set_Color (Node : Node_Access; Color : Color_Type);
88 pragma Inline (Set_Color);
90 -----------------------
91 -- Local Subprograms --
92 -----------------------
94 function Copy_Node (Source : Node_Access) return Node_Access;
95 pragma Inline (Copy_Node);
97 function Copy_Tree (Source_Root : Node_Access) return Node_Access;
99 procedure Delete_Tree (X : in out Node_Access);
101 function Is_Equal_Node_Node (L, R : Node_Access) return Boolean;
102 pragma Inline (Is_Equal_Node_Node);
104 function Is_Greater_Key_Node
105 (Left : Key_Type;
106 Right : Node_Access) return Boolean;
107 pragma Inline (Is_Greater_Key_Node);
109 function Is_Less_Key_Node
110 (Left : Key_Type;
111 Right : Node_Access) return Boolean;
112 pragma Inline (Is_Less_Key_Node);
114 --------------------------
115 -- Local Instantiations --
116 --------------------------
118 procedure Free is new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
120 package Tree_Operations is
121 new Red_Black_Trees.Generic_Operations
122 (Tree_Types => Tree_Types,
123 Null_Node => Node_Access'(null));
125 use Tree_Operations;
127 package Key_Ops is
128 new Red_Black_Trees.Generic_Keys
129 (Tree_Operations => Tree_Operations,
130 Key_Type => Key_Type,
131 Is_Less_Key_Node => Is_Less_Key_Node,
132 Is_Greater_Key_Node => Is_Greater_Key_Node);
134 function Is_Equal is
135 new Tree_Operations.Generic_Equal (Is_Equal_Node_Node);
137 ---------
138 -- "<" --
139 ---------
141 function "<" (Left, Right : Cursor) return Boolean is
142 begin
143 return Left.Node.Key < Right.Node.Key;
144 end "<";
146 function "<" (Left : Cursor; Right : Key_Type) return Boolean is
147 begin
148 return Left.Node.Key < Right;
149 end "<";
151 function "<" (Left : Key_Type; Right : Cursor) return Boolean is
152 begin
153 return Left < Right.Node.Key;
154 end "<";
156 ---------
157 -- "=" --
158 ---------
160 function "=" (Left, Right : Map) return Boolean is
161 begin
162 if Left'Address = Right'Address then
163 return True;
164 end if;
166 return Is_Equal (Left.Tree, Right.Tree);
167 end "=";
169 ---------
170 -- ">" --
171 ---------
173 function ">" (Left, Right : Cursor) return Boolean is
174 begin
175 return Right.Node.Key < Left.Node.Key;
176 end ">";
178 function ">" (Left : Cursor; Right : Key_Type) return Boolean is
179 begin
180 return Right < Left.Node.Key;
181 end ">";
183 function ">" (Left : Key_Type; Right : Cursor) return Boolean is
184 begin
185 return Right.Node.Key < Left;
186 end ">";
188 ------------
189 -- Adjust --
190 ------------
192 procedure Adjust (Container : in out Map) is
193 Tree : Tree_Type renames Container.Tree;
195 N : constant Count_Type := Tree.Length;
196 X : constant Node_Access := Tree.Root;
198 begin
199 if N = 0 then
200 pragma Assert (X = null);
201 return;
202 end if;
204 Tree := (Length => 0, others => null);
206 Tree.Root := Copy_Tree (X);
207 Tree.First := Min (Tree.Root);
208 Tree.Last := Max (Tree.Root);
209 Tree.Length := N;
210 end Adjust;
212 -------------
213 -- Ceiling --
214 -------------
216 function Ceiling (Container : Map; Key : Key_Type) return Cursor is
217 Node : constant Node_Access := Key_Ops.Ceiling (Container.Tree, Key);
219 begin
220 if Node = null then
221 return No_Element;
222 end if;
224 return Cursor'(Container'Unchecked_Access, Node);
225 end Ceiling;
227 -----------
228 -- Clear --
229 -----------
231 procedure Clear (Container : in out Map) is
232 Tree : Tree_Type renames Container.Tree;
233 Root : Node_Access := Tree.Root;
234 begin
235 Tree := (Length => 0, others => null);
236 Delete_Tree (Root);
237 end Clear;
239 -----------
240 -- Color --
241 -----------
243 function Color (Node : Node_Access) return Color_Type is
244 begin
245 return Node.Color;
246 end Color;
248 --------------
249 -- Contains --
250 --------------
252 function Contains (Container : Map; Key : Key_Type) return Boolean is
253 begin
254 return Find (Container, Key) /= No_Element;
255 end Contains;
257 ---------------
258 -- Copy_Node --
259 ---------------
261 function Copy_Node (Source : Node_Access) return Node_Access is
262 Target : constant Node_Access :=
263 new Node_Type'(Parent => null,
264 Left => null,
265 Right => null,
266 Color => Source.Color,
267 Key => Source.Key,
268 Element => Source.Element);
269 begin
270 return Target;
271 end Copy_Node;
273 ---------------
274 -- Copy_Tree --
275 ---------------
277 function Copy_Tree (Source_Root : Node_Access) return Node_Access is
278 Target_Root : Node_Access := Copy_Node (Source_Root);
279 P, X : Node_Access;
281 begin
282 if Source_Root.Right /= null then
283 Target_Root.Right := Copy_Tree (Source_Root.Right);
284 Target_Root.Right.Parent := Target_Root;
285 end if;
287 P := Target_Root;
288 X := Source_Root.Left;
290 while X /= null loop
291 declare
292 Y : Node_Access := Copy_Node (X);
294 begin
295 P.Left := Y;
296 Y.Parent := P;
298 if X.Right /= null then
299 Y.Right := Copy_Tree (X.Right);
300 Y.Right.Parent := Y;
301 end if;
303 P := Y;
304 X := X.Left;
305 end;
306 end loop;
308 return Target_Root;
310 exception
311 when others =>
312 Delete_Tree (Target_Root);
313 raise;
314 end Copy_Tree;
316 ------------
317 -- Delete --
318 ------------
320 procedure Delete (Container : in out Map; Position : in out Cursor) is
321 begin
322 if Position = No_Element then
323 return;
324 end if;
326 if Position.Container /= Map_Access'(Container'Unchecked_Access) then
327 raise Program_Error;
328 end if;
330 Delete_Node_Sans_Free (Container.Tree, Position.Node);
331 Free (Position.Node);
333 Position.Container := null;
334 end Delete;
336 procedure Delete (Container : in out Map; Key : Key_Type) is
337 X : Node_Access := Key_Ops.Find (Container.Tree, Key);
339 begin
340 if X = null then
341 raise Constraint_Error;
342 end if;
344 Delete_Node_Sans_Free (Container.Tree, X);
345 Free (X);
346 end Delete;
348 ------------------
349 -- Delete_First --
350 ------------------
352 procedure Delete_First (Container : in out Map) is
353 Position : Cursor := First (Container);
354 begin
355 Delete (Container, Position);
356 end Delete_First;
358 -----------------
359 -- Delete_Last --
360 -----------------
362 procedure Delete_Last (Container : in out Map) is
363 Position : Cursor := Last (Container);
364 begin
365 Delete (Container, Position);
366 end Delete_Last;
369 -----------------
370 -- Delete_Tree --
371 -----------------
373 procedure Delete_Tree (X : in out Node_Access) is
374 Y : Node_Access;
375 begin
376 while X /= null loop
377 Y := X.Right;
378 Delete_Tree (Y);
379 Y := X.Left;
380 Free (X);
381 X := Y;
382 end loop;
383 end Delete_Tree;
385 -------------
386 -- Element --
387 -------------
389 function Element (Position : Cursor) return Element_Type is
390 begin
391 return Position.Node.Element;
392 end Element;
394 function Element (Container : Map; Key : Key_Type) return Element_Type is
395 Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key);
396 begin
397 return Node.Element;
398 end Element;
400 -------------
401 -- Exclude --
402 -------------
404 procedure Exclude (Container : in out Map; Key : Key_Type) is
405 X : Node_Access := Key_Ops.Find (Container.Tree, Key);
407 begin
408 if X /= null then
409 Delete_Node_Sans_Free (Container.Tree, X);
410 Free (X);
411 end if;
412 end Exclude;
414 ----------
415 -- Find --
416 ----------
418 function Find (Container : Map; Key : Key_Type) return Cursor is
419 Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key);
421 begin
422 if Node = null then
423 return No_Element;
424 end if;
426 return Cursor'(Container'Unchecked_Access, Node);
427 end Find;
429 -----------
430 -- First --
431 -----------
433 function First (Container : Map) return Cursor is
434 begin
435 if Container.Tree.First = null then
436 return No_Element;
437 end if;
439 return Cursor'(Container'Unchecked_Access, Container.Tree.First);
440 end First;
442 -------------------
443 -- First_Element --
444 -------------------
446 function First_Element (Container : Map) return Element_Type is
447 begin
448 return Container.Tree.First.Element;
449 end First_Element;
451 ---------------
452 -- First_Key --
453 ---------------
455 function First_Key (Container : Map) return Key_Type is
456 begin
457 return Container.Tree.First.Key;
458 end First_Key;
460 -----------
461 -- Floor --
462 -----------
464 function Floor (Container : Map; Key : Key_Type) return Cursor is
465 Node : constant Node_Access := Key_Ops.Floor (Container.Tree, Key);
467 begin
468 if Node = null then
469 return No_Element;
470 end if;
472 return Cursor'(Container'Unchecked_Access, Node);
473 end Floor;
475 -----------------
476 -- Has_Element --
477 -----------------
479 function Has_Element (Position : Cursor) return Boolean is
480 begin
481 return Position /= No_Element;
482 end Has_Element;
484 -------------
485 -- Include --
486 -------------
488 procedure Include
489 (Container : in out Map;
490 Key : Key_Type;
491 New_Item : Element_Type)
493 Position : Cursor;
494 Inserted : Boolean;
496 begin
497 Insert (Container, Key, New_Item, Position, Inserted);
499 if not Inserted then
500 Position.Node.Key := Key;
501 Position.Node.Element := New_Item;
502 end if;
503 end Include;
505 procedure Insert
506 (Container : in out Map;
507 Key : Key_Type;
508 New_Item : Element_Type;
509 Position : out Cursor;
510 Inserted : out Boolean)
512 function New_Node return Node_Access;
513 pragma Inline (New_Node);
515 procedure Insert_Post is
516 new Key_Ops.Generic_Insert_Post (New_Node);
518 procedure Insert_Sans_Hint is
519 new Key_Ops.Generic_Conditional_Insert (Insert_Post);
521 --------------
522 -- New_Node --
523 --------------
525 function New_Node return Node_Access is
526 Node : constant Node_Access :=
527 new Node_Type'(Parent => null,
528 Left => null,
529 Right => null,
530 Color => Red,
531 Key => Key,
532 Element => New_Item);
533 begin
534 return Node;
535 end New_Node;
537 -- Start of processing for Insert
539 begin
540 Insert_Sans_Hint
541 (Container.Tree,
542 Key,
543 Position.Node,
544 Inserted);
546 Position.Container := Container'Unchecked_Access;
547 end Insert;
549 procedure Insert
550 (Container : in out Map;
551 Key : Key_Type;
552 New_Item : Element_Type)
554 Position : Cursor;
555 Inserted : Boolean;
557 begin
558 Insert (Container, Key, New_Item, Position, Inserted);
560 if not Inserted then
561 raise Constraint_Error;
562 end if;
563 end Insert;
565 ------------
566 -- Insert --
567 ------------
569 procedure Insert
570 (Container : in out Map;
571 Key : Key_Type;
572 Position : out Cursor;
573 Inserted : out Boolean)
575 function New_Node return Node_Access;
576 pragma Inline (New_Node);
578 procedure Insert_Post is
579 new Key_Ops.Generic_Insert_Post (New_Node);
581 procedure Insert_Sans_Hint is
582 new Key_Ops.Generic_Conditional_Insert (Insert_Post);
584 --------------
585 -- New_Node --
586 --------------
588 function New_Node return Node_Access is
589 Node : Node_Access := new Node_Type;
591 begin
592 begin
593 Node.Key := Key;
594 exception
595 when others =>
596 Free (Node);
597 raise;
598 end;
600 return Node;
601 end New_Node;
603 -- Start of processing for Insert
605 begin
606 Insert_Sans_Hint
607 (Container.Tree,
608 Key,
609 Position.Node,
610 Inserted);
612 Position.Container := Container'Unchecked_Access;
613 end Insert;
615 --------------
616 -- Is_Empty --
617 --------------
619 function Is_Empty (Container : Map) return Boolean is
620 begin
621 return Container.Tree.Length = 0;
622 end Is_Empty;
624 ------------------------
625 -- Is_Equal_Node_Node --
626 ------------------------
628 function Is_Equal_Node_Node
629 (L, R : Node_Access) return Boolean is
630 begin
631 return L.Element = R.Element;
632 end Is_Equal_Node_Node;
634 -------------------------
635 -- Is_Greater_Key_Node --
636 -------------------------
638 function Is_Greater_Key_Node
639 (Left : Key_Type;
640 Right : Node_Access) return Boolean
642 begin
643 -- k > node same as node < k
645 return Right.Key < Left;
646 end Is_Greater_Key_Node;
648 ----------------------
649 -- Is_Less_Key_Node --
650 ----------------------
652 function Is_Less_Key_Node
653 (Left : Key_Type;
654 Right : Node_Access) return Boolean
656 begin
657 return Left < Right.Key;
658 end Is_Less_Key_Node;
660 -------------
661 -- Iterate --
662 -------------
664 procedure Iterate
665 (Container : Map;
666 Process : not null access procedure (Position : Cursor))
668 procedure Process_Node (Node : Node_Access);
669 pragma Inline (Process_Node);
671 procedure Local_Iterate is
672 new Tree_Operations.Generic_Iteration (Process_Node);
674 ------------------
675 -- Process_Node --
676 ------------------
678 procedure Process_Node (Node : Node_Access) is
679 begin
680 Process (Cursor'(Container'Unchecked_Access, Node));
681 end Process_Node;
683 -- Start of processing for Iterate
685 begin
686 Local_Iterate (Container.Tree);
687 end Iterate;
689 ---------
690 -- Key --
691 ---------
693 function Key (Position : Cursor) return Key_Type is
694 begin
695 return Position.Node.Key;
696 end Key;
698 ----------
699 -- Last --
700 ----------
702 function Last (Container : Map) return Cursor is
703 begin
704 if Container.Tree.Last = null then
705 return No_Element;
706 end if;
708 return Cursor'(Container'Unchecked_Access, Container.Tree.Last);
709 end Last;
711 ------------------
712 -- Last_Element --
713 ------------------
715 function Last_Element (Container : Map) return Element_Type is
716 begin
717 return Container.Tree.Last.Element;
718 end Last_Element;
720 --------------
721 -- Last_Key --
722 --------------
724 function Last_Key (Container : Map) return Key_Type is
725 begin
726 return Container.Tree.Last.Key;
727 end Last_Key;
729 ----------
730 -- Left --
731 ----------
733 function Left (Node : Node_Access) return Node_Access is
734 begin
735 return Node.Left;
736 end Left;
738 ------------
739 -- Length --
740 ------------
742 function Length (Container : Map) return Count_Type is
743 begin
744 return Container.Tree.Length;
745 end Length;
747 ----------
748 -- Move --
749 ----------
751 procedure Move (Target : in out Map; Source : in out Map) is
752 begin
753 if Target'Address = Source'Address then
754 return;
755 end if;
757 Move (Target => Target.Tree, Source => Source.Tree);
758 end Move;
760 ----------
761 -- Next --
762 ----------
764 procedure Next (Position : in out Cursor) is
765 begin
766 Position := Next (Position);
767 end Next;
769 function Next (Position : Cursor) return Cursor is
770 begin
771 if Position = No_Element then
772 return No_Element;
773 end if;
775 declare
776 Node : constant Node_Access :=
777 Tree_Operations.Next (Position.Node);
779 begin
780 if Node = null then
781 return No_Element;
782 end if;
784 return Cursor'(Position.Container, Node);
785 end;
786 end Next;
788 ------------
789 -- Parent --
790 ------------
792 function Parent (Node : Node_Access) return Node_Access is
793 begin
794 return Node.Parent;
795 end Parent;
797 --------------
798 -- Previous --
799 --------------
801 procedure Previous (Position : in out Cursor) is
802 begin
803 Position := Previous (Position);
804 end Previous;
806 function Previous (Position : Cursor) return Cursor is
807 begin
808 if Position = No_Element then
809 return No_Element;
810 end if;
812 declare
813 Node : constant Node_Access :=
814 Tree_Operations.Previous (Position.Node);
816 begin
817 if Node = null then
818 return No_Element;
819 end if;
821 return Cursor'(Position.Container, Node);
822 end;
823 end Previous;
825 -------------------
826 -- Query_Element --
827 -------------------
829 procedure Query_Element
830 (Position : Cursor;
831 Process : not null access procedure (Element : Element_Type))
833 begin
834 Process (Position.Node.Key, Position.Node.Element);
835 end Query_Element;
837 ----------
838 -- Read --
839 ----------
841 procedure Read
842 (Stream : access Root_Stream_Type'Class;
843 Container : out Map)
845 N : Count_Type'Base;
847 function New_Node return Node_Access;
848 pragma Inline (New_Node);
850 procedure Local_Read is new Tree_Operations.Generic_Read (New_Node);
852 --------------
853 -- New_Node --
854 --------------
856 function New_Node return Node_Access is
857 Node : Node_Access := new Node_Type;
859 begin
860 begin
861 Key_Type'Read (Stream, Node.Key);
862 Element_Type'Read (Stream, Node.Element);
863 exception
864 when others =>
865 Free (Node);
866 raise;
867 end;
869 return Node;
870 end New_Node;
872 -- Start of processing for Read
874 begin
875 Clear (Container);
876 Count_Type'Base'Read (Stream, N);
877 pragma Assert (N >= 0);
879 Local_Read (Container.Tree, N);
880 end Read;
882 -------------
883 -- Replace --
884 -------------
886 procedure Replace
887 (Container : in out Map;
888 Key : Key_Type;
889 New_Item : Element_Type)
891 Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key);
893 begin
894 if Node = null then
895 raise Constraint_Error;
896 end if;
898 Node.Key := Key;
899 Node.Element := New_Item;
900 end Replace;
902 ---------------------
903 -- Replace_Element --
904 ---------------------
906 procedure Replace_Element (Position : Cursor; By : Element_Type) is
907 begin
908 Position.Node.Element := By;
909 end Replace_Element;
911 ---------------------
912 -- Reverse_Iterate --
913 ---------------------
915 procedure Reverse_Iterate
916 (Container : Map;
917 Process : not null access procedure (Position : Cursor))
919 procedure Process_Node (Node : Node_Access);
920 pragma Inline (Process_Node);
922 procedure Local_Reverse_Iterate is
923 new Tree_Operations.Generic_Reverse_Iteration (Process_Node);
925 ------------------
926 -- Process_Node --
927 ------------------
929 procedure Process_Node (Node : Node_Access) is
930 begin
931 Process (Cursor'(Container'Unchecked_Access, Node));
932 end Process_Node;
934 -- Start of processing for Reverse_Iterate
936 begin
937 Local_Reverse_Iterate (Container.Tree);
938 end Reverse_Iterate;
940 -----------
941 -- Right --
942 -----------
944 function Right (Node : Node_Access) return Node_Access is
945 begin
946 return Node.Right;
947 end Right;
949 ---------------
950 -- Set_Color --
951 ---------------
953 procedure Set_Color
954 (Node : Node_Access;
955 Color : Color_Type)
957 begin
958 Node.Color := Color;
959 end Set_Color;
961 --------------
962 -- Set_Left --
963 --------------
965 procedure Set_Left (Node : Node_Access; Left : Node_Access) is
966 begin
967 Node.Left := Left;
968 end Set_Left;
970 ----------------
971 -- Set_Parent --
972 ----------------
974 procedure Set_Parent (Node : Node_Access; Parent : Node_Access) is
975 begin
976 Node.Parent := Parent;
977 end Set_Parent;
980 ---------------
981 -- Set_Right --
982 ---------------
984 procedure Set_Right (Node : Node_Access; Right : Node_Access) is
985 begin
986 Node.Right := Right;
987 end Set_Right;
989 --------------------
990 -- Update_Element --
991 --------------------
993 procedure Update_Element
994 (Position : Cursor;
995 Process : not null access procedure (Element : in out Element_Type))
997 begin
998 Process (Position.Node.Key, Position.Node.Element);
999 end Update_Element;
1001 -----------
1002 -- Write --
1003 -----------
1005 procedure Write
1006 (Stream : access Root_Stream_Type'Class;
1007 Container : Map)
1009 procedure Process (Node : Node_Access);
1010 pragma Inline (Process);
1012 procedure Iterate is new Tree_Operations.Generic_Iteration (Process);
1014 -------------
1015 -- Process --
1016 -------------
1018 procedure Process (Node : Node_Access) is
1019 begin
1020 Key_Type'Write (Stream, Node.Key);
1021 Element_Type'Write (Stream, Node.Element);
1022 end Process;
1024 -- Start of processing for Write
1026 begin
1027 Count_Type'Base'Write (Stream, Container.Tree.Length);
1028 Iterate (Container.Tree);
1029 end Write;
1031 end Ada.Containers.Ordered_Maps;