ComPPare 1.0.0
Loading...
Searching...
No Matches
comppare::internal::policy::ErrorPolicy Concept Reference

Concept for a valid Error Policy. More...

#include <policy.hpp>

Concept definition

template<typename Val, typename EP>
{
{ EP::metric_count() } -> std::convertible_to<std::size_t>;
{ EP::metric_name(std::size_t{}) } -> std::convertible_to<std::string_view>;
} &&
(requires(EP ep, const Val &a, const Val &b) { ep.compute_error(a, b); }) &&
(requires(EP ep, std::size_t i) {
{ ep.metric(i) } -> IsMetricValue; } || requires(EP ep, std::size_t i) {
{ ep.metric(i) } -> std::convertible_to<double>; } || requires(EP ep, std::size_t i) {
{ ep.metric(i) } -> std::same_as<std::string>; }) &&
(requires(EP ep) {
{ ep.is_fail() } -> std::convertible_to<bool>; })
Concept for a valid Error Policy.
Definition policy.hpp:192

Detailed Description

Concept for a valid Error Policy.

Template Parameters
ValThe type of the values being compared
EPThe type of the error policy

Requirements:

  • Static Members:
    1. metric_count() - returns the number of metrics
    2. metric_name(std::size_t i) - returns the name of the metric at index i
  • Member Functions:
    1. compute_error(const Val &a, const Val &b)
      • computes the error between two values a and b with or without a given tolerance (via global config)
    2. metric(std::size_t)
      • returns the value of the metric as MetricValue<T>,
      • or convertible to double,
      • or convertible to std::string
    3. is_fail()
      • returns true if the case passed, any custom condition is allowed.