Monado OpenXR Runtime
Public Member Functions | Data Fields
FindLowestScore< ValueType, FunctionType > Struct Template Reference

Helper struct that keeps the value that produces the lowest "score" as computed by your functor. More...

Public Member Functions

void handle_candidate (ValueType val)
 

Data Fields

const FunctionType score_functor
 
bool got_one {false}
 
ValueType best {}
 
float best_score {0}
 

Detailed Description

template<typename ValueType, typename FunctionType>
struct FindLowestScore< ValueType, FunctionType >

Helper struct that keeps the value that produces the lowest "score" as computed by your functor.

Having this as a struct with a method, instead of a single "algorithm"-style function, allows you to keep your complicated filtering logic in your own loop, just calling in when you have a new candidate for "best".

Note
Create by calling make_lowest_score_finder() with your function/lambda that takes an element and returns the score, to deduce the un-spellable typename of the lambda.
Template Parameters
ValueTypeThe type of a single element value - whatever you want to assign a score to.
FunctionTypeThe type of your functor/lambda that turns a ValueType into a float "score". Usually deduced.

Member Function Documentation

◆ handle_candidate()

template<typename ValueType , typename FunctionType >
void FindLowestScore< ValueType, FunctionType >::handle_candidate ( ValueType  val)
inline

Field Documentation

◆ best

template<typename ValueType , typename FunctionType >
ValueType FindLowestScore< ValueType, FunctionType >::best {}

◆ best_score

template<typename ValueType , typename FunctionType >
float FindLowestScore< ValueType, FunctionType >::best_score {0}

◆ got_one

template<typename ValueType , typename FunctionType >
bool FindLowestScore< ValueType, FunctionType >::got_one {false}

◆ score_functor

template<typename ValueType , typename FunctionType >
const FunctionType FindLowestScore< ValueType, FunctionType >::score_functor

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