-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscalar.h
More file actions
23 lines (16 loc) · 850 Bytes
/
scalar.h
File metadata and controls
23 lines (16 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef SCALAR_H
#define SCALAR_H
#include<type_traits>
namespace godefv::math{
//!A Scalar is a type representing a mathematical expression, the product of which with anything commutes.
template<class T> concept Number=std::is_arithmetic<T>::value;
template<class T> struct is_simple_scalar:std::false_type{};
template<Number NumberT> struct is_simple_scalar<NumberT>:std::true_type{};
template<class T> concept SimpleScalar=is_simple_scalar<T>::value;
template<class T> concept NonSimpleScalar=!SimpleScalar<T>;
template<class T> struct is_scalar:std::false_type{};
template<SimpleScalar SimpleScalarT> struct is_scalar<SimpleScalarT>:std::true_type{};
template<class T> concept Scalar=SimpleScalar<T> || is_scalar<T>::value;
template<class T> concept NonScalar=NonSimpleScalar<T> && !is_scalar<T>::value;
}
#endif /* SCALAR_H */