Back to Aurora Vision Library website

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

SortArray


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

Changes the order of the input array elements according to an ascending/descending sequence of the value array.

Syntax

void avl::SortArray
(
	const atl::Array<Type>& inArray,
	const atl::Array<float>& inValues,
	avl::SortingOrder::Type inSortingOrder,
	atl::Array<Type>& outSortedArray,
	atl::Array<float>& outSortedValues
)

Parameters

Name Type Default Description
Input value inArray const Array<Type>& Elements to be sorted
Input value inValues const Array<float>& Values defining the order
Input value inSortingOrder SortingOrder::Type Sorting order
Output value outSortedArray Array<Type>& Sorted elements
Output value outSortedValues Array<float>& Sorted values

Examples

inArray = {"John","Alice","Bob","Karen"}
inValues = {0.0,10.0,4.0,3.0}
outSortedArray = {"John","Karen","Bob","Alice"}
outSortedValues = {0.0,3.0,4.0,10.0}

Errors

List of possible exceptions:

Error type Description
DomainError Inconsistent array sizes in SortArray.

See Also

  • GetSortedElements – Returns elements corresponding to 8 smallest/biggest values from the array of values.