MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::Magnitude Concept Reference

Concept: a type has a well-defined magnitude. More...

#include <magnitude.hpp>

Concept definition

template<typename T>
concept mtl::Magnitude = std::is_unsigned_v<std::remove_cv_t<T>> || detail::magnitude_adl::has_abs<T>
Concept: a type has a well-defined magnitude.
Definition magnitude.hpp:41
abs(a) as generic code calls it: std::abs for the built-in types, and the number type's own abs found...
Definition magnitude.hpp:32

Detailed Description

Concept: a type has a well-defined magnitude.

An unsigned type is its own magnitude: std::abs is ill-formed for unsigned types that do not promote to int, so the abs functor returns them unchanged, and the concept agrees.