Re: Adding functions to generic package



On 2005-05-29, Matthew Heaney <matthewjheaney@xxxxxxxxxxxxx> wrote:
> Preben Randhol <randhol+valid_for_reply_from_news@xxxxxxx> writes:
>
>> On 2005-05-29, Preben Randhol wrote:
>> > Another question. Why isn't there a Swap function in the library
>> > like the one that you have in the Reverse_Container? I can make
>> > something using two splices although a bit less effective I should
>> > imagine?
>>
>> I meant not the same as it would have to be:
>>
>> procedure Swap (L,R : Iterator_Type);
>
>
> OK, that makes sense. There's an operation like that (Swap_Links) in
> the Ada 200Y standard container library. I can add that to Charles.

I guess it must be:

procedure Swap (Container : in out Container_Type; L,R : Iterator_Type);

as I want the Swap to Swap say element in position 4 with element in
postion 2 in the list but by using iterators to point at them.


Preben
.



Relevant Pages

  • Re: Some advice for a lisp newb
    ... > and array references give locations instead of values, ... In C++, to swap two array elements, we can use something like this: ... Now in CL, I wrote a similar but less general swap function this way, ...
    (comp.lang.lisp)
  • Re: How increase a C/C++ Program speed ?
    ... But never mind... ... > bitwise operation you can get faster the your program. ... We do this swap function like that: ... > Yeah, this function swap the integers, too. ...
    (comp.lang.cpp)
  • How increase a C/C++ Program speed ?
    ... bitwise operation you can get faster the your program. ... we talk about swap function. ... For a integer swapping we ...
    (comp.lang.cpp)
  • Re: swap two integers without using a tmp variable?
    ... > How do you rewrite the swap function without using a tmp variable in ... > the swap function???? ... > int main ...
    (comp.lang.cpp)
  • Re: Swapping Bullshit
    ... Ioannis Vranos wrote: ... >> Try this code for different implementations of the swap function, ...
    (comp.lang.cpp)