Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::ValidScalarType Concept Reference

Concept satisfied by any type that behaves as a mathematical scalar. More...

#include <Scalar.hpp>

Concept definition

template<typename T>
concept ValidScalarType = requires(T a, T b) {
{ a + b } -> std::convertible_to<T>;
{ a - b } -> std::convertible_to<T>;
{ a * b } -> std::convertible_to<T>;
{ a / b } -> std::convertible_to<T>;
{ -a } -> std::convertible_to<T>;
T(1.0); // constructible from a double literal
}
Concept satisfied by any type that behaves as a mathematical scalar.
Definition Scalar.hpp:101

Detailed Description

Accepts fundamental arithmetic types (float, double, int, ...), std::complex, Sacado FAD types, autodiff duals, Ceres Jets — any type providing scalar arithmetic operators and constructibility from a numeric literal.

Use this instead of std::is_arithmetic_v<T> wherever the intent is "I need a type I can do math with", not "I specifically need a primitive type". The broader acceptance enables automatic differentiation without code changes.