comp.lang.ada
 help / color / mirror / Atom feed
From: Marius Amado Alves <amado.alves@netcabo.pt>
To: comp.lang.ada@ada-france.org
Subject: Re: Adding functions to generic package
Date: Thu, 2 Jun 2005 13:49:31 +0100
Date: 2005-06-02T13:49:31+01:00	[thread overview]
Message-ID: <mailman.1.1117716630.17633.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <uhdgilub7.fsf@earthlink.net>

>>> I guess it must be:
>>>
>>>    procedure Swap (Container : in out Container_Type; L,R :
>>> Iterator_Type);
>>
>> No need. Cursors know their containers. (Marius)
>
> No, this is wrong.
>
> In Charles, iterators do *not* carry a pointer to container...
> Mario is probably thinking of the Ada 2005 standard container library. 
> (Matthew)

Yes. Sorry.

> Cursor types do indeed hold a pointer to the container, in addition to
> the node.  However, the rule about manipulation of the container object
> still applies (what a coincidence!), so the container is passed as a
> parameter too (see the operation named Swap_Links).

Ada.Containers has this operation for Lists and Vectors:

procedure Swap (I, J      : in Cursor);

with semantics

"If either I or J is No_Element, then Constraint_Error is propagated. 
If I and J
designate elements in different containers, then Program_Error is 
propagated.
Otherwise Swap exchanges the values of the elements designated by I and 
J."

(cf. http://www.softdevelcoop.org/software/ada_containers)

Is "exchanging values" not "manipulating the container?"




  reply	other threads:[~2005-06-02 12:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-28 15:44 Adding functions to generic package Preben Randhol
2005-05-28 16:27 ` Matthew Heaney
2005-05-28 18:18   ` Preben Randhol
2005-05-28 18:20     ` Preben Randhol
2005-05-29  0:56     ` Matthew Heaney
2005-05-29  8:41       ` Preben Randhol
2005-05-29 14:37         ` Matthew Heaney
2005-05-29 21:31           ` Preben Randhol
2005-05-29 21:33             ` Preben Randhol
2005-05-29 22:30               ` Matthew Heaney
2005-05-30 20:45                 ` Preben Randhol
2005-05-30 22:28                   ` Marius Amado Alves
2005-06-01  1:50                     ` Matthew Heaney
2005-06-02 12:49                       ` Marius Amado Alves [this message]
2005-06-02 13:11                         ` Matthew Heaney
2005-06-01  1:41                   ` Matthew Heaney
2005-05-29 22:27             ` 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