Collaboration diagram for Swapping:

Algorithms for swapping elements. More...


(void) + swap:and:
 Swap two elements.
(void) + swapIterators:and:
 Swap elements to which iterators point.
(OLForwardIterator *) + swapRangesFrom:to:with:
 Swap elements in two ranges.

Detailed Description

Algorithms for swapping elements.

Individual elements, elements referred to by iterators, and entire ranges may be swapped.

See also:

Function Documentation

+ (void) swap: (id *)  left
and: (id *)  right 

Swap two elements.

The message performs a very fast swap of two distinct elements given pointers to the elements.

left the first element to swap
right the second element to swap

+ (void) swapIterators: (OLIterator *)  left
and: (OLIterator *)  right 

Swap elements to which iterators point.

The element pointed to by left is assigned to the element pointed to by the iterator right and vice versa.

left the first iterator to swap
right the second iterator to swap

+ (OLForwardIterator*) swapRangesFrom: (OLForwardIterator *)  first1
to: (OLForwardIterator *)  last1
with: (OLForwardIterator *)  first2 

Swap elements in two ranges.

All elements in the range [first1, last1) are assigned to the corresponding element in the range starting at first2 and vice versa. An iterator is returned pointing to one position beyond the last element swapped in the range starting from first2.

The range starting at first2 must have at least as many valid elements as the range [first1, last1).
If OpenStep is present the returned object will be autoreleased before being returned.
first1 the first in the first range to swap
last1 one beyond the last in the first range to swap
first2 the first in the second range to swap
an iterator pointing to one beyond the last element swapped in the range starting from first2

ObjectiveLibGenerated Sun Apr 22 15:18:03 2007, © 2004-2007 Will Mason
SourceForge.net Logo