Back to Aurora Vision Library website

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

AvsFilter_GetArrayElement_OrNil


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; returns NIL if the index is out of range.

Syntax

void avs::AvsFilter_GetArrayElement_OrNil
(
	const atl::Array<Type>& inArray,
	int inIndex,
	bool inInverse,
	typename atl::ToConditionalType<Type>::Type& outConditionalValue
)

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 outConditionalValue typename ToConditionalType<Type>::Type& Element from the array

Hints

  • If you can guarantee that inIndex will always be in range, use AvsFilter_GetArrayElement instead.
  • To get the last element of an array use inIndex = 0 and inInverse = True.

Examples

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

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

Errors

List of possible exceptions:

Error type Description
DomainError Negative index in GetArrayElement_OrNil.

See Also