Algorithms for swapping elements.
More...
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:
-
left | the first element to swap |
right | the second element to swap |
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:
-
left | the first iterator to swap |
right | the second iterator to swap |
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:
-
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 |
- Returns:
- an iterator pointing to one beyond the last element swapped in the range starting from first2