7 #if !defined(CNL_IMPL_OVERFLOW_POLARITY_H)
8 #define CNL_IMPL_OVERFLOW_POLARITY_H
15 enum class polarity { negative = -1,
19 [[nodiscard]] constexpr
auto operator-(polarity
const& p)
21 return static_cast<polarity
>(-
static_cast<int>(p));
24 [[nodiscard]] constexpr
auto operator*(polarity
const& lhs, polarity
const& rhs)
26 return static_cast<polarity
>(
static_cast<int>(lhs) *
static_cast<int>(rhs));
30 [[nodiscard]] constexpr
auto measure_polarity(T
const& value)
32 return (value > T{}) ? polarity::positive
33 : (value < T{}) ? polarity::negative
39 #endif // CNL_IMPL_OVERFLOW_POLARITY_H