From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ac8:5fcd:0:b0:35c:d514:eb86 with SMTP id k13-20020ac85fcd000000b0035cd514eb86mr2167674qta.616.1663343223711; Fri, 16 Sep 2022 08:47:03 -0700 (PDT) X-Received: by 2002:a05:620a:4083:b0:6ce:7e02:5cb8 with SMTP id f3-20020a05620a408300b006ce7e025cb8mr4445680qko.170.1663343223496; Fri, 16 Sep 2022 08:47:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 16 Sep 2022 08:47:03 -0700 (PDT) In-Reply-To: <6a8a1468-5148-49d7-b342-327f8eaf8097n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=96.241.104.184; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 96.241.104.184 References: <6a8a1468-5148-49d7-b342-327f8eaf8097n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <36c9b75d-2d3b-4882-894d-21c44d8a383fn@googlegroups.com> Subject: Re: Non-standard functions in GNAT's Ada.Containers packages? From: Jere Injection-Date: Fri, 16 Sep 2022 15:47:03 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2654 Xref: reader01.eternal-september.org comp.lang.ada:64342 List-Id: On Thursday, September 15, 2022 at 1:11:19 PM UTC-4, amado...@gmail.com wrote: > Thanks, Niklas. > > > ... There are functions First and Next ... procedure Iterate ... > > Too verbose and error-prone (forget the Next and you get an endless loop). > > "for X of M loop ... end loop". > Not possible for maps. I'm not sure I understand. I tried it in gnat 11 and it compiled just fine: ************************************************* with Ada.Text_IO; use Ada.Text_IO; with Ada.Containers.Ordered_Maps; procedure Program is package Maps is new Ada.Containers.Ordered_Maps(Integer,Integer); Map : Maps.Map; begin Map.Insert(1,10); Map.Insert(2,20); Map.Insert(3,30); Map.Insert(4,40); for Element of Map loop Put_Line(Element'Image); end loop; end Program; ************************************************* Output: 10 20 30 40 ************************************************* Even tried it on some online compilers and it compiled and ran: IDEONE online compiler: https://ideone.com/H2oEZt If this isn't what you mean, what is the missing feature.? the "for of" version does work for maps as far as I can tell.