diff options
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 -- |