Add Number concept in terms of IsNumber
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)
Merge request reports
Activity
added concepts suggestion labels
mentioned in merge request !1401
- Resolved by Simon Praetorius
When we introduces
IsNumber
we deliberately did not call itIsScalar
because the standard already has a concept of 'scalars' (std::is_scalar
) which is neither a subset nor a superset of ourIsNumber
: It e.g. includes pointer-to-members but must not be specialized for custom types representing numbers.The pros and cons of
IsScalar
have already been discussed and let toIsNumber
. Hence the concept introduced here should be calledNumber
.
added 7 commits
-
f254b111...fa579ea1 - 6 commits from branch
master
- a771892c - Add Number concept in terms of IsNumber
-
f254b111...fa579ea1 - 6 commits from branch
mentioned in commit 6573ed38