aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-ciorma.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-ciorma.adb')
-rw-r--r--gcc/ada/a-ciorma.adb44
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ada/a-ciorma.adb b/gcc/ada/a-ciorma.adb
index 3de57c76aa4..cd95b9fd5ab 100644
--- a/gcc/ada/a-ciorma.adb
+++ b/gcc/ada/a-ciorma.adb
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Operations);
with Ada.Containers.Red_Black_Trees.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Ordered_Maps is
pragma Suppress (All_Checks);
@@ -287,6 +289,37 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is
+ new Tree_Operations.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key.all, New_Item => Node.Element.all);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Insert_Items (Target.Tree);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -340,6 +373,17 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Map) return Map is
+ begin
+ return Target : Map do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------