Back to Aurora Vision Library website

You are here: Start » Function Reference » All Functions » Array Transforms » SwapArrayElements

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: avl
Module: FoundationLite

Swaps two elements of an array.

Syntax

void avl::SwapArrayElements
(
	atl::Array<Type>& ioArray,
	const int inIndex1,
	const int inIndex2,
	bool inInverse
)

Parameters

Name Type Range Default Description
Input will be modified ioArray Array<Type>&
Input value inIndex1 const int 0 - Index of the first element being swapped
Input value inIndex2 const int 0 - Index of the second element being swapped
Input value 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.