Back to Aurora Vision Library website

You are here: Start » Function Reference » All Functions » Conditional Processing » SelectByPredicate

SelectByPredicate


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

Selects the elements from the input array for which the associated predicate is True.

Syntax

void avl::SelectByPredicate
(
	const atl::Array<Type>& inArray,
	const atl::Array<bool>& inPredicate,
	atl::Array<Type>& outSelected
)

Parameters

Name Type Default Description
Input value inArray const Array<Type>& Elements to be classified
Input value inPredicate const Array<bool>& Corresponding logical values determining the output array for each of the elements
Output value outSelected Array<Type>& Array of elements corresponding to 'true' values

Hints

  • Also consider using the "select" function in formulas.
  • Before using this filter you need to have an array of objects (to be classified) and an array of boolean values that describe which elements of the first array fulfill some condition.
  • Connect the array of objects to the inArray input and connect the array of boolean values to the inPredicate input.
  • If you also need the array of rejected elements at the same time, use ClassifyByPredicate filter instead.

Examples

inArray = {"Alice", "Bill", "Frank", "Patricia", "Thomas"}
inPredicate = {True,True,False,False,True}
outSelected = {"Alice", "Bill", "Thomas"}

Errors

List of possible exceptions:

Error type Description
DomainError Inconsistent array lengths on input in ClassifyByPredicate.

See Also

  • ClassifyByPredicate – Separates the elements of the input array into two output arrays. The first output array contains all the elements for which the associated predicate is True.
  • SelectByRange – Selects the elements of the input that fall into the specified range.