|
cisst-saw
|
#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) |
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.
| typedef vctFixedSizeVectorRecursiveEngines<_size-1>::template Find<_conditionOperationType, _currentIndex+1> Find< _conditionOperationType, _currentIndex >::RecursiveStep |
|
inlinestatic |