Back to FabImage Library website
You are here: Start » Function Reference » All Functions » Array Basics » FisFilter_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: | fis |
Module: | FoundationLite |
Extracts a single element from an array at the specified index; returns NIL if the index is out of range.
Syntax
void fis::FisFilter_GetArrayElement_OrNil ( const ftl::Array<Type>& inArray, int inIndex, bool inInverse, typename ftl::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 | Determines if the indices are counted from beginning or from end of the input array | |
![]() |
outConditionalValue | typename ToConditionalType<Type>::Type& | Element from the array |
Hints
- If you can guarantee that inIndex will always be in range, use FisFilter_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
- FisFilter_SetArrayElement – Sets an element of an array to a new value.