|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
Configuration 3 via the ADL hook: does Acc's own namespace provide the super-accumulator functions for products of Values? More...
#include <accumulator_traits.hpp>
Configuration 3 via the ADL hook: does Acc's own namespace provide the super-accumulator functions for products of Values?
The functions, found by argument-dependent lookup on Acc:
accumulator_clear(acc) acc = 0 accumulator_assign(acc, v) acc = v, exactly accumulator_add_product(acc, m, v) acc += m * v accumulator_value(acc, std::type_identity<R>{}) -> R, the single round-out accumulator_merge(acc, other) acc += other (optional)
accumulator_value takes a std::type_identity<Result> tag rather than an explicit template argument so that the call is an ordinary ADL call on every compiler. accumulator_merge is optional: an accumulator without it still satisfies the hook, and only merge() is unavailable.
Constrain the functions on the accumulator type. They are also looked up in the namespaces associated with Value, so an unconstrained template <class A> void accumulator_clear(A&) in a number library would claim accumulator_traits<double, its_number> too.