diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-09-13 10:37:49 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-09-13 10:37:49 -0700 |
commit | e252b51ccde010cbd2a146485d8045103cd99533 (patch) | |
tree | e060f101cdc32bf5e520de8e5275db9d4236b74c /gcc/ada/libgnat/a-coboho.adb | |
parent | f10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff) | |
parent | 104c05c5284b7822d770ee51a7d91946c7e56d50 (diff) | |
download | gcc-e252b51ccde010cbd2a146485d8045103cd99533.zip gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2 |
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'gcc/ada/libgnat/a-coboho.adb')
-rw-r--r-- | gcc/ada/libgnat/a-coboho.adb | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/ada/libgnat/a-coboho.adb b/gcc/ada/libgnat/a-coboho.adb index 5d44163..21b9f54 100644 --- a/gcc/ada/libgnat/a-coboho.adb +++ b/gcc/ada/libgnat/a-coboho.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2015-2020, Free Software Foundation, Inc. -- +-- Copyright (C) 2015-2021, 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- -- @@ -65,12 +65,32 @@ package body Ada.Containers.Bounded_Holders is return Get (Left) = Get (Right); end "="; + ------------------------ + -- Constant_Reference -- + ------------------------ + + function Constant_Reference + (Container : aliased Holder) return not null access constant Element_Type + is + begin + return Cast (Container'Address); + end Constant_Reference; + + --------- + -- Get -- + --------- + + function Get (Container : Holder) return Element_Type is + begin + return Cast (Container'Address).all; + end Get; + --------------- -- Put_Image -- --------------- procedure Put_Image - (S : in out Ada.Strings.Text_Output.Sink'Class; V : Holder) + (S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : Holder) is use System.Put_Images; begin @@ -79,14 +99,16 @@ package body Ada.Containers.Bounded_Holders is Array_After (S); end Put_Image; - --------- - -- Get -- - --------- + --------------- + -- Reference -- + --------------- - function Get (Container : Holder) return Element_Type is + function Reference + (Container : not null access Holder) return not null access Element_Type + is begin - return Cast (Container'Address).all; - end Get; + return Cast (Container.all'Address); + end Reference; --------- -- Set -- |