diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-04 09:58:07 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-04 09:58:07 +0000 |
commit | eb07c23faa11fbcb74709aee56b0e66a45e949c4 (patch) | |
tree | 5c092a2498a4cada2cfb133adc362e3c6001ea2e /gcc/ada/a-cohase.adb | |
parent | 26f2feff5b5aa17b33c3ad5aee5f15220ed277de (diff) | |
download | gcc-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-cohase.adb')
-rw-r--r-- | gcc/ada/a-cohase.adb | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/gcc/ada/a-cohase.adb b/gcc/ada/a-cohase.adb index 643dde5d964..e0b2345234b 100644 --- a/gcc/ada/a-cohase.adb +++ b/gcc/ada/a-cohase.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -159,6 +159,16 @@ package body Ada.Containers.Hashed_Sets is Node.Element := Item; end Assign; + procedure Assign (Target : in out Set; Source : Set) is + begin + if Target'Address = Source'Address then + return; + end if; + + Target.Clear; + Target.Union (Source); + end Assign; + -------------- -- Capacity -- -------------- @@ -186,6 +196,34 @@ package body Ada.Containers.Hashed_Sets is return Find (Container, Item) /= No_Element; end Contains; + ---------- + -- Copy -- + ---------- + + function Copy + (Source : Set; + Capacity : Count_Type := 0) return Set + 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 : Set do + Target.Reserve_Capacity (C); + Target.Assign (Source); + end return; + end Copy; + --------------- -- Copy_Node -- --------------- |