cisst-saw
Loading...
Searching...
No Matches
Find< _conditionOperationType, _currentIndex > Class Template Reference

#include <vctFixedSizeVectorRecursiveEngines.h>

Public Types

typedef vctFixedSizeVectorRecursiveEngines< _size-1 >::template Find< _conditionOperationType, _currentIndex+1 > RecursiveStep

Static Public Member Functions

template<class _inputVectorType, class _inputScalarType>
static vct::index_type Unfold (const _inputVectorType *inputVector, const _inputScalarType &inputScalar)

Detailed Description

template<class _conditionOperationType, vct::index_type _currentIndex>
class Find< _conditionOperationType, _currentIndex >

The Find engine returns the first index in which a condition evaluates to 'true'. The index is returned as an unsigned integer. The condition is evaluated between each element of the input vector and the input scalar, in the form _conditionOperationType::Operate(inputVector[index], inputScalar). That is, the static method Operate is a binary predicate.

The Find engine uses an auxiliary template argument _currentIndex which is incremented as the recursion nesting increases. We need it so that we don't have to evaluate the function again to return the index.

If the condition never evaluates to true, the function returns a value one past the length of the vector (_size).

A typical example assigned _conditionOperation with an equality test, searching for the first occurence of a value in the vector.

Member Typedef Documentation

◆ RecursiveStep

template<class _conditionOperationType, vct::index_type _currentIndex>
typedef vctFixedSizeVectorRecursiveEngines<_size-1>::template Find<_conditionOperationType, _currentIndex+1> Find< _conditionOperationType, _currentIndex >::RecursiveStep

Member Function Documentation

◆ Unfold()

template<class _conditionOperationType, vct::index_type _currentIndex>
template<class _inputVectorType, class _inputScalarType>
vct::index_type Find< _conditionOperationType, _currentIndex >::Unfold ( const _inputVectorType * inputVector,
const _inputScalarType & inputScalar )
inlinestatic

The documentation for this class was generated from the following file: