Overview of Ada 2022
Jeff Cousins
Contents   Index   Search   Previous   Next 

4.8 Indefinite Holders

Bounded_Indefinite_Holders (AI12-0254) adds a new container type, Bounded_Indefinite_Holder (see RM A.18.32), which allows the storage of a (single) class-wide object without the use of dynamic memory allocation, for use in safety critical environments. Rather than having a bounded indefinite variant of every container, it is envisaged that this holder container would be used as a building block, e.g. in a container of such holder containers.
Compared with the existing Indefinite_Holder, there is an additional generic parameter:
Max_Element_Size_in_Storage_Elements : Storage_Count;
If this is exceeded, Program_Error is raised.
Swap for Indefinite_Holders (AI12-0350) adds a Swap operation to both Indefinite_Holder and the new Bounded_Indefinite_Holder. For the former this avoids the overhead of copying the element (and any associated Adjust/Finalize).
procedure Swap (Left, Right : in out Holder)
   ...

Contents   Index   Search   Previous   Next 
© 2021, 2022 Jeff Cousins