1#ifndef CONFIDENT_QUANTITY_HPP_B2XVJERI
2#define CONFIDENT_QUANTITY_HPP_B2XVJERI
20 constexpr T worst_confidence()
const
22 using value_type =
typename T::value_type;
23 return T::from_value(std::numeric_limits<value_type>::has_infinity ?
24 std::numeric_limits<value_type>::infinity() :
25 std::numeric_limits<value_type>::max());
28 constexpr T default_value()
const
30 using value_type =
typename T::value_type;
31 return T::from_value(std::numeric_limits<value_type>::has_quiet_NaN ?
32 std::numeric_limits<value_type>::quiet_NaN() : value_type());
35 constexpr bool is_nan(
const T& t)
const
37 return t.value() != t.value();
41 m_value(default_value()), m_confidence(worst_confidence()) {}
43 m_value(value), m_confidence(worst_confidence()) {}
45 m_value(value), m_confidence(!is_nan(confidence) ? confidence : worst_confidence()) {}
52 void assign(
const T& value,
const T& confidence)
55 m_confidence = !is_nan(confidence) ? confidence : worst_confidence();
58 const T& value()
const
63 const T& confidence()
const