12#define WUZP_DEFINE_RECURSIVE_TRAIT_IMPL(Name, NameStr) \
13 template <typename... Ts> \
15 template <typename T0> \
19 template <typename T0, typename T1> \
20 struct Name<T0, T1> { \
22 static_assert(FailOnInstantiation<Name<T0, T1>>::value, "'" NameStr "' trait not specialized for given type."); \
24 template <typename T0, typename T1, typename T2, typename... Ts> \
25 struct Name<T0, T1, T2, Ts...> { \
27 using type = typename Name<typename Name<T0, T1>::type, T2, Ts...>::type; \
29#define WUZP_DEFINE_RECURSIVE_TRAIT(Name) WUZP_DEFINE_RECURSIVE_TRAIT_IMPL(Name, #Name)
31template <
typename Label>
33template <
typename T,
typename... Args>
73template <
typename Lhs,
typename Rhs>
80template <
typename Lhs,
typename Rhs>
82 static_assert(std::is_same<Lhs, Rhs>::value,
"Value types mismatch.");
85template <
typename Lhs,
typename Rhs>
86auto sum(
const Lhs& lhs,
const Rhs& rhs);
90template <
typename Lhs,
typename Rhs>
92 static_assert(std::is_same<Lhs, Rhs>::value,
"Value types mismatch.");
96template <
typename Lhs,
typename Rhs>
100template <
typename Rhs>
104template <
typename Rhs>
109template <
typename Lhs,
typename Rhs>
111 static_assert(std::is_same<Lhs, Rhs>::value,
"Value types mismatch.");
114template <
typename Lhs,
typename Rhs>
118template <
typename Lhs,
typename Rhs>
122template <
typename Lhs,
typename Rhs>
125template <
typename Lhs,
typename Rhs>
129template <
typename Lhs,
typename Rhs>
132template <
typename Lhs,
typename Rhs>
136template <
typename Lhs,
typename Rhs>
141template <
typename Lhs,
typename Rhs>
143 static_assert(std::is_same<Lhs, Rhs>::value,
"Value types mismatch.");
146template <
typename Lhs,
typename Rhs>
149template <
typename T,
typename ExponentT_>
159template <
typename Object,
int ElementRowIdV_,
int ElementColIdV_>
162 "'Element' trait not specialized for given type.");
165template <
typename Object,
int BlockRowIdV_,
int BlockColIdV_,
int BlockRowsV_,
int BlockColsV_>
168 "'Block' trait not specialized for given type.");
202template <
typename T,
typename FunctionT_>
264template <
typename To,
typename... From>
297template <
typename T,
typename NewCoordinateSystemT_>
300 "'CastCoordinateSystem' trait not specialized for given types.");
302template <
typename To,
typename T>
309template <
typename ImplementationT_,
typename MatrixSizeT_>
315template <
typename ImplementationT_,
typename ArgsTupleT_>
329template <
typename T,
typename ValueT_,
int RowsV_,
int ColsV_>
337template <
typename UnitT_>
340 "'AccessUnits' trait not specialized for given type. Make sure you included the necessary unit headers.");
353template <
typename ValueT_>
355 static_assert(std::is_integral_v<ValueT_>,
"'Precision' trait not specialized for given types.");
356 static constexpr ValueT_
value() {
return 0; }
361 static constexpr float value() {
return 1e-5f; }
366 static constexpr double value() {
return 1e-12; }
#define WUZP_DEFINE_RECURSIVE_TRAIT(Name)
auto product(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const ValueRhsT_ rhs)
Tag< FromImplementationLabel > FromImplementation
auto negation(const Quantities< ValuesT_, UnitsT_ > &rhs)
auto outerProduct(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
auto dotProduct(const Lhs &lhs, const Rhs &rhs)
auto innerProduct(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
auto crossProduct(const Lhs &lhs, const Rhs &rhs)
auto makeRelative(T t)
The vector from the origin of the coordinate system to a point, p - o: the same components,...
Tag< FromImplementationArgsLabel > FromImplementationArgs
auto castCoordinateSystem(T t)
Tag< FromSimilarLabel > FromSimilar
auto division(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const ValueRhsT_ rhs)
auto difference(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
auto sum(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
auto makeAbsolute(T t)
The point at a vector from the origin of the coordinate system, o + v: the same components,...
The units for values of the arithmetic type ValueT_, e.g. double, specialized for AccessImplementatio...
Element access of a matrix of a value matrix backend: get(impl, row, col) returns an element,...
Copies a matrix of a value matrix backend: value returns the copy, which must not share its values wi...
A function applied to every element of a matrix, like Eigen's DenseBase::unaryExpr(): value(impl,...
The elementwise reciprocal of a matrix, like Eigen's ArrayBase::inverse() or cwiseInverse().
static constexpr int value
False for every type, so that a static_assert on it fails only when the template that names it is ins...
Initializes an allocated matrix of a value matrix backend with its elements, row by row: run(impl,...
The inverse: the matrix inverse of a matrix, like Eigen's MatrixBase::inverse(), and the reciprocal o...
Whether converting a From into a To passes the checks of the converting constructor of To,...
Moves a matrix of a value matrix backend: construct returns the moved matrix, assign moves it into an...
The negation is performed elementwise.
static constexpr double value()
static constexpr float value()
static constexpr long double value()
The default precision of isApprox() for values of the type ValueT_, which compares relatively: 1e-12 ...
static constexpr ValueT_ value()
The evaluated type of another value type and size, of the same backend as T: e.g. the 1x1 values of a...
Allocates a default constructed matrix of a value matrix backend for the size MatrixSizeT_: run(impl)...
Wrapper for partial specializations of trait for values types.