Re: limited types (Was: Records that could be arrays)
- From: "Matthew Heaney" <mheaney@xxxxxxx>
- Date: 27 Feb 2006 08:52:23 -0800
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.)
.
- Follow-Ups:
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- References:
- limited types (Was: Records that could be arrays)
- From: Thierry Bernier
- Re: limited types (Was: Records that could be arrays)
- From: Randy Brukardt
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Georg Bauhaus
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- limited types (Was: Records that could be arrays)
- Prev by Date: Re: OT: Re: help with include and library files in GPS
- Next by Date: Re: OT: Re: help with include and library files in GPS
- Previous by thread: Re: limited types (Was: Records that could be arrays)
- Next by thread: Re: limited types (Was: Records that could be arrays)
- Index(es):
Relevant Pages
|
|