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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,443dd11dd1cfaec9 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.106.199 with SMTP id gw7mr169089wib.0.1344571587668; Thu, 09 Aug 2012 21:06:27 -0700 (PDT) Path: n2ni53786789win.0!nntp.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!xlned.com!feeder5.xlned.com!feed.xsnews.nl!border-2.ams.xsnews.nl!news.panservice.it!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!usenet-fr.net!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 03 Aug 2012 15:18:01 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Abstraction over container iterators References: <75425fa8-7885-48d8-9eeb-8f90a1bfb128@googlegroups.com> In-Reply-To: Message-ID: <501bcf83$0$6548$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 03 Aug 2012 15:17:56 CEST NNTP-Posting-Host: 2cf3bc23.newsspool4.arcor-online.net X-Trace: DXC=Oh[U5F`>=;1n`gW2MTm]<34IUK:Lh>_cHTX3j=_WF3Zn55c=0 X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-08-03T15:17:56+02:00 List-Id: On 03.08.12 14:52, Dmitry A. Kazakov wrote: > On Fri, 3 Aug 2012 05:01:41 -0700 (PDT), ms wrote: > >> What we have here is an example package fairly well illustrating my >> problem. I'm storing some environment variables in Hashed_Map, but I want >> to build a abstraction layer over the standard container, so I can in >> future change the underlaying container without changing any code in my >> package's customers. >> >> Getting and setting variables is easy - as declared above. The real >> problem is iterating. I'd like to let my package's customers to iterate >> over the environment and get both key and value for each element easily. > > Add the iteration abstraction to the package. The implementation would both > do both the container and the iterator. 2nd. The type has-a container, so it has-a cursor as well. Your type could supply a call-back style iteration mechanism, too, such as generic with Customery_Query (Name : Unbounded_String); procedure For_Every_Name (E : Environment); Or use an anonymous procedure pointer instead of a template.