Skip to content

Add Number concept in terms of IsNumber

Simon Praetorius requested to merge feature/concept-scalar into master

Summary

We use the type traits Dune::IsNumber to define leaf nodes element-types in (hierarchically nested) containers, e.g., to have break conditions for recursive algorithms and a restriction which scalar types can be used in constant initialization and scalar multiplication of these containers. This type trait is moved into a concept. This is a preparation for a later more specific characterization of the semantics of such (scalar) number types.

Applications

While one could also use the traits class IsNumber, a concept gives a little bit syntactic sugar. We could write

template <class T, int n>
auto operator(const auto Concept:Number& factor, const FieldVector<T,n>& vector);
// or
template <Concept:Number N, class T, int n>
auto operator(const N& factor, const FieldVector<T,n>& vector);

Later, we could maybe be more precise about the number type, e.g., using Concept::Field (!1494)

Edited by Simon Praetorius

Merge request reports

Loading