Back to Aurora Vision Library website

You are here: Start » Function Reference » All Functions » Array Basics » AvsFilter_GetArrayElement

AvsFilter_GetArrayElement


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

Extracts a single element from an array at the specified index.

Syntax

void avs::AvsFilter_GetArrayElement
(
	const atl::Array<Type>& inArray,
	int inIndex,
	bool inInverse,
	Type& outValue
)

Parameters

Name Type Range Default Description
Input value inArray const Array<Type>& Input array
Input value inIndex int 0 - Index within the array
Input value inInverse bool False Determines if the indices are counted from beginning or from end of the input array
Output value outValue Type& Element from the array

Hints

  • Make sure that inIndex will always be in range. If this cannot be guaranteed, use AvsFilter_GetArrayElement_OrNil instead.
  • To get the last element of a non-empty array use inIndex = 0 and inInverse = True.

Examples

inArray = {1,4,3,2,5}
inIndex = 3
inInverse = False
outValue = 2

inArray = {1,4,3,2,5}
inIndex = 3
inInverse = True
outValue = 4

Errors

List of possible exceptions:

Error type Description
DomainError Index out of range in GetArrayElement.
DomainError Negative index in GetArrayElement.

See Also