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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.52.26.145 with SMTP id l17mr1010472vdg.2.1422366875860; Tue, 27 Jan 2015 05:54:35 -0800 (PST) X-Received: by 10.140.83.41 with SMTP id i38mr12191qgd.11.1422366875832; Tue, 27 Jan 2015 05:54:35 -0800 (PST) Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!bm13no3317359qab.0!news-out.google.com!q4ni8qan.0!nntp.google.com!v8no3835436qal.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 27 Jan 2015 05:54:35 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.99.113.5; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 83.99.113.5 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9ceb847e-d064-47e7-aa11-7707b63d4308@googlegroups.com> Subject: Problem implementing Iterators From: Laurent Injection-Date: Tue, 27 Jan 2015 13:54:35 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.giganews.com comp.lang.ada:192059 Date: 2015-01-27T05:54:35-08:00 List-Id: Hi I tried to add an iterator to my double linked list using the example from John Barnes Ada 2005 book, chapter about iterators. For the moment the only procedure using the iterator is the Display one. In my test app I get this error when I compile it: package GL_String is new Double_Linked_Lists_Generic (Element_Type => Name_Type, Display_Element => Display_String ); L1 : GL_String.List ; GL_String.Display (L1); <-- error expected an access type with designated private type "List" defined at double_linked_lists_generic.ads:7, instance at line 23 found private type "List" defined at double_linked_lists_generic.ads:7, instance at line 23 List and Iterator are defined as: type List is limited private; type Iterator (L : access List) is limited private; (...) private type List_Node; type List_Ptr is access List_Node; type List_Node is record Element : Element_Type; Next : List_Ptr; Previous:List_Ptr; end record; type List is record <-- example in the book is a list without head/tail Head : List_Ptr; Tail : List_Ptr; end record; type Iterator (L : access List) is limited record This : List_Ptr; end record; So how do I get this to work? Thanks