From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.160.9 with SMTP id xg9mr14953913pab.38.1459821804235; Mon, 04 Apr 2016 19:03:24 -0700 (PDT) X-Received: by 10.157.55.164 with SMTP id x33mr293688otb.9.1459821804185; Mon, 04 Apr 2016 19:03:24 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!nt3no7831148igb.0!news-out.google.com!u9ni494igk.0!nntp.google.com!nt3no7831137igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 4 Apr 2016 19:03:23 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=37.190.52.68; posting-account=YB4WOgoAAABLG9D7qoJiPBc6EJSzsPDF NNTP-Posting-Host: 37.190.52.68 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Ada 2005,Doubly_Linked_List with Controlled parameter From: George J Injection-Date: Tue, 05 Apr 2016 02:03:24 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:29975 Date: 2016-04-04T19:03:23-07:00 List-Id: Hi all! I'm using Doubly_Linked_List with Controlled param, example here: ---------------------------------------------------------------------- type Info_Record is new Controlled with record Name:String_Access; end record; type Info is access all Info_Record'Class; overriding procedure Finalize(Self:in out Info_Record); package Test_Containers is new Ada.Containers.Doubly_Linked_Lists(Info_R= ecord); use Test_Containers; Test_List:Test_Containers.List; ---------------------------------------------------------------------- procedure Free_String is new Ada.Unchecked_Deallocation (Object =3D> String, Name =3D> String_Access); overriding procedure Finalize(Self:in out Info_Record) is begin if Self.Name/=3Dnull then Free_String(Self.Name); end if; end Finalize; ---------------------------------------------------------------------- procedure Test is begin Test_List.Append(Info_Record'(Controlled with Name =3D> new String'("Test_Name")); end Test; ---------------------------------------------------------------------- Problem is that after calling "Append"->at once starts Finalization proc,= so appended pure line. I just use an access parameter after this "Doubly_L= inked_List(Info)", and it's ok now,but i think that i'm wrong,cause Finaliz= ation doesn't start with Test_List.Clear and when exiting program. So quest= ion is "How I can finalize Doubly_Connected_List Controlled parameter corre= ctly?Or I must not use Controlled parameter in this list?". Thanks!