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.

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