Back to FabImage Library website
You are here: Start » Function Reference » All Functions » Array Transforms » SwapArrayElements
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | STD.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Swaps two elements of an array.
Syntax
void fil::SwapArrayElements ( ftl::Array<Type>& ioArray, const int inIndex1, const int inIndex2, bool inInverse )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
ioArray | Array<Type>& | |||
![]() |
inIndex1 | const int | 0 - ![]() |
Index of the first element being swapped | |
![]() |
inIndex2 | const int | 0 - ![]() |
Index of the second element being swapped | |
![]() |
inInverse | bool | False | Determines if the indices are counted from beginning or from end of the input array |
Examples
![]() |
![]() |
inArray = {1,4,3,2,5} inIndex1 = 0 inIndex2 = 4 |
outArray = {5,4,3,2,1} |
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Index out of range in SwapArrayElements. |
See Also
- ReverseArray – Creates an array of the input array elements in reversed order.
- RotateArray – Cyclically shifts the elements of an array.