summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coinve.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-04 09:58:07 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-04 09:58:07 +0000
commiteb07c23faa11fbcb74709aee56b0e66a45e949c4 (patch)
tree5c092a2498a4cada2cfb133adc362e3c6001ea2e /gcc/ada/a-coinve.adb
parent26f2feff5b5aa17b33c3ad5aee5f15220ed277de (diff)
downloadgcc-eb07c23faa11fbcb74709aee56b0e66a45e949c4.tar.gz
2011-11-04 Matthew Heaney <heaney@adacore.com>
* a-cdlili.ad[sb], a-cidlli.ad[sb], a-coorse.ad[sb], a-ciorse.ad[sb], a-coorma.ad[sb], a-ciorma.ad[sb], a-coormu.ad[sb], a-ciormu.ad[sb], a-cohama.ad[sb], a-cihama.ad[sb], a-cohase.ad[sb], a-cihase.ad[sb], a-convec.ad[sb], a-coinve.ad[sb] (Assign, Copy): New operations added to package. 2011-11-04 Robert Dewar <dewar@adacore.com> * sem_ch12.adb: Minor reformatting 2011-11-04 Gary Dismukes <dismukes@adacore.com> * bindgen.adb (Gen_Elab_Calls): In the case of the AAMP target, initialize elaboration entities to zero when specs are processed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180930 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coinve.adb')
-rw-r--r--gcc/ada/a-coinve.adb42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 3172bd2c7b5..ae72e65ed51 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -616,6 +616,20 @@ package body Ada.Containers.Indefinite_Vectors is
Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Vector; Source : Vector) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Append (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -698,6 +712,34 @@ package body Ada.Containers.Indefinite_Vectors is
return Find_Index (Container, Item) /= No_Index;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Vector;
+ Capacity : Count_Type := 0) return Vector
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Vector do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------