ObjectiveLib  1.0.0
Swapping
Algorithms

Algorithms for swapping elements. More...

Collaboration diagram for Swapping:

Swapping

(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:
OLAlgorithm

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.

Parameters:
leftthe first element to swap
rightthe 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.

Parameters:
leftthe first iterator to swap
rightthe 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.

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

ObjectiveLibGenerated Sat Feb 15 2014 07:45:33, © 2004-2007 Will Mason