Back to Adaptive Vision Library website
You are here: Start » Function Reference » Array Basics » AvsFilter_GetArrayElement_OrNil
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
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 | |
---|---|---|---|---|---|
inArray | const Array<Type>& | Input array | |||
inIndex | int | 0 - | Index within the array | ||
inInverse | bool | False | Reversed order in the array | ||
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
Error type | Description |
---|---|
DomainError | Negative index in GetArrayElement_OrNil. |
See Also
- SetArrayElement