comp.lang.ada
 help / color / mirror / Atom feed
* On absurdity of collections 7.6.1 (11.1/3)
@ 2021-09-29  9:09 Dmitry A. Kazakov
  2021-09-29 11:05 ` Simon Wright
  2021-09-30 18:23 ` G.B.
  0 siblings, 2 replies; 15+ messages in thread
From: Dmitry A. Kazakov @ 2021-09-29  9:09 UTC (permalink / raw)


For Ada programmers who wonder what it is, here is a practical example. 
Given the package specification:

    package P is
       type Item (Length : Positive) is
          new Ada.Finalization.Limited_Controlled with
       record
          Text : String (1..Length);
       end record;
       overriding procedure Finalize (X : in out Item);

       type Item_Ptr is access all Item;
       function New_Item
                (  Pool : in out Root_Storage_Pool'Class;
                   Text : String
                )  return Item_Ptr;
       procedure Free is new Ada.Unchecked_Deallocation (Item, Item_Ptr);
    end P;

and the program using it like this:

    Ptr : Item_Ptr := New_Item (Some_Pool, "A");

    ...

    Free (Ptr);

Write the package body.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-10-01  7:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29  9:09 On absurdity of collections 7.6.1 (11.1/3) Dmitry A. Kazakov
2021-09-29 11:05 ` Simon Wright
2021-09-29 11:20   ` Dmitry A. Kazakov
2021-09-29 21:38     ` Simon Wright
2021-09-30  8:07       ` Dmitry A. Kazakov
2021-09-30  8:35         ` Simon Wright
2021-09-30  8:49           ` Dmitry A. Kazakov
2021-10-01  1:37         ` Randy Brukardt
2021-10-01  7:57           ` Dmitry A. Kazakov
2021-09-30  0:23     ` Randy Brukardt
2021-09-30  8:06       ` Dmitry A. Kazakov
2021-09-30 18:23 ` G.B.
2021-09-30 18:52   ` Dmitry A. Kazakov
2021-10-01  1:40     ` Randy Brukardt
2021-10-01  7:57       ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox