ImFusion SDK 4.3
BisectionSearch< T, U > Class Template Reference

#include <ImFusion/Base/Math.h>

Templated bisection search algorithm, finds the interval in a sorted array in which any given value falls. More...

Detailed Description

template<class T, class U>
class ImFusion::Math::BisectionSearch< T, U >

Templated bisection search algorithm, finds the interval in a sorted array in which any given value falls.

Parameters
dataArray to search position in, must be sorted in ascending order
valueThe value whose approximate position in the array we want to determine
lessAny suitable less-than comparison function
Returns
Lower index of the lower-inclusive interval the value falls into (e.g. 2 if searching for 2.7 in {0, 1, 2, 3, 4, 5} with trivial comparison function)

Public Member Functions

 BisectionSearch (const std::vector< T > &data, const U &value, const std::function< bool(const T &, const U &)> &lessOrEqual=[](const T &a, const U &b) { return a<=b;})
 
int search ()
 

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close