diff options
Diffstat (limited to 'gcc/ada/a-cdlili.adb')
-rw-r--r-- | gcc/ada/a-cdlili.adb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb index 497a1112d43..326c74b0785 100644 --- a/gcc/ada/a-cdlili.adb +++ b/gcc/ada/a-cdlili.adb @@ -146,6 +146,27 @@ package body Ada.Containers.Doubly_Linked_Lists is Insert (Container, No_Element, New_Item, Count); end Append; + ------------ + -- Assign -- + ------------ + + procedure Assign (Target : in out List; Source : List) is + Node : Node_Access; + + begin + if Target'Address = Source'Address then + return; + end if; + + Target.Clear; + + Node := Source.First; + while Node /= null loop + Target.Append (Node.Element); + Node := Node.Next; + end loop; + end Assign; + ----------- -- Clear -- ----------- @@ -206,6 +227,17 @@ package body Ada.Containers.Doubly_Linked_Lists is return Find (Container, Item) /= No_Element; end Contains; + ---------- + -- Copy -- + ---------- + + function Copy (Source : List) return List is + begin + return Target : List do + Target.Assign (Source); + end return; + end Copy; + ------------ -- Delete -- ------------ |