MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ fitness_of()

template<typename Op>
Fitness MayaFlux::Yantra::fitness_of ( )

The candidate's fitness for an erased input.

Calls static float Op::fitness(const input_type&) when the class has one. Returns an empty function otherwise, which the grammar counts as neutral (1).

Definition at line 19 of file GrammarHelper.hpp.

20{
21 if constexpr (requires(const typename Op::input_type& in) { { Op::fitness(in) } -> std::convertible_to<float>; }) {
22 return [](const std::any& input) -> float {
23 const auto* typed = std::any_cast<typename Op::input_type>(&input);
24 return typed ? static_cast<float>(Op::fitness(*typed)) : 0.0F;
25 };
26 } else {
27 return {};
28 }
29}

Referenced by MayaFlux::Yantra::OperationRegistry::catalog_impl(), and MayaFlux::Yantra::ComputationGrammar::RuleBuilder::uses().

Here is the caller graph for this function: