comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Abstraction over container iterators
Date: Fri, 3 Aug 2012 14:52:24 +0200
Date: 2012-08-03T14:52:24+02:00	[thread overview]
Message-ID: <i9is3q4sqqpl.10qr524zyhhcm$.dlg@40tude.net> (raw)
In-Reply-To: 75425fa8-7885-48d8-9eeb-8f90a1bfb128@googlegroups.com

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.

> As I'm using Ada 2012 the best way would be to use iterators,

I prefer plain indices over iterators. Just have get/put an element by its
positive index. Most containers should have array interface.

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



  reply	other threads:[~2012-08-10  4:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03 12:01 Abstraction over container iterators ms
2012-08-03 12:52 ` Dmitry A. Kazakov [this message]
2012-08-03 13:18   ` Georg Bauhaus
replies disabled

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