comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: limited types (Was: Records that could be arrays)
Date: 27 Feb 2006 08:52:23 -0800
Date: 2006-02-27T08:52:23-08:00	[thread overview]
Message-ID: <1141059143.617291.39980@i40g2000cwc.googlegroups.com> (raw)
In-Reply-To: <1i6nwodxgp1bn.voklt7nvcl1g$.dlg@40tude.net>


Dmitry A. Kazakov wrote:
>
> 1. Passing as a parameter

Just pass a cursor:

procedure Op (C : in out Container_Type) is
begin
   Do_Something (C.First);
   ...
end;

You know you've run out of elements when Has_Element returns False.


> 2. Copying

while (Has_Element (C) loop
  Put_Element_Somewhere (Element (C);
end loop;

> 3. Merging

You'll need to define a relational operator over your element type, but
then you can say:

Merge (C1.First, C2.First);


> 4. Slicing

Just use a cursor pair:

Do_Something (C1, C2);  -- half-open range


> 5. Closures and simultaneous traversal of two or more containers

Do_Something (C1, C2);


> 6. Relational operations on sets of containers

Compare (C1, C2);


If you don't understand this, go to

http://charles.tigris.org

and browse the Charles.Algorithms subsystem.  (Things are a little
different for the Ada 2005 container library, but it should give you
the general idea.)




  reply	other threads:[~2006-02-27 16:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24 16:51 limited types (Was: Records that could be arrays) Thierry Bernier
2006-02-24 21:57 ` Randy Brukardt
2006-02-25  2:21   ` Matthew Heaney
2006-02-25  3:38     ` Matthew Heaney
2006-02-25 11:06   ` Dmitry A. Kazakov
2006-02-25 15:05     ` Matthew Heaney
2006-02-26  1:01       ` Randy Brukardt
2006-02-26  9:00       ` Dmitry A. Kazakov
2006-02-26 18:20         ` Matthew Heaney
2006-02-26 20:52           ` Dmitry A. Kazakov
2006-02-26 22:07             ` Matthew Heaney
2006-02-27  9:11               ` Dmitry A. Kazakov
2006-02-27 14:34                 ` Georg Bauhaus
2006-02-27 16:05                   ` Dmitry A. Kazakov
2006-02-27 16:52                     ` Matthew Heaney [this message]
2006-02-27 20:21                       ` Dmitry A. Kazakov
2006-02-27 21:40                         ` Georg Bauhaus
2006-02-28  9:38                           ` Dmitry A. Kazakov
2006-02-27 23:00                         ` Matthew Heaney
2006-02-28  9:39                           ` Dmitry A. Kazakov
2006-02-28 17:24                             ` Matthew Heaney
2006-02-28 19:06                               ` Dmitry A. Kazakov
2006-02-28 19:58                                 ` Matthew Heaney
2006-02-28 21:03                                   ` Dmitry A. Kazakov
2006-02-28 21:51                                   ` limited types Simon Wright
2006-03-01  1:59                                     ` Matthew Heaney
replies disabled

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