LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
scalar_traits.h
1
10#ifndef __e384f4f7485d447c8d3f33406a0f5f7e
11#define __e384f4f7485d447c8d3f33406a0f5f7e
12
13#include <complex>
14#include <type_traits>
15
16namespace lf::base {
17
25template <class T, typename = void>
26struct IsScalar {
27 static constexpr bool value = false;
28};
29
33template <class T>
34struct IsScalar<T, std::enable_if_t<std::is_arithmetic_v<T>>> {
35 static constexpr bool value = true;
36};
37
42template <class T>
43struct IsScalar<std::complex<T>, std::enable_if_t<std::is_arithmetic_v<T>>> {
44 static constexpr bool value = true;
45};
46
55template <class T>
56inline constexpr bool is_scalar = IsScalar<T>::value;
57
58} // namespace lf::base
59
60#endif // __e384f4f7485d447c8d3f33406a0f5f7e
Contains basic functionality that is used by other parts of LehrFEM++.
Definition: base.h:15
constexpr bool is_scalar
Variable template that determines if a type T is a scalar type, i.e. if it is a "field" in the mathem...
Definition: scalar_traits.h:56
Base Traits class which can be used to determine if a type T is a scalar value.
Definition: scalar_traits.h:26
static constexpr bool value
Definition: scalar_traits.h:27