mgcpp
A C++ Math Library Based on CUDA
is_scalar.hpp
Go to the documentation of this file.
1 
2 // Copyright RedPortal, mujjingun 2017 - 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef _MGCPP_TYPE_TRAITS_IS_SCALAR_HPP_
8 #define _MGCPP_TYPE_TRAITS_IS_SCALAR_HPP_
9 
10 #include <complex>
12 #include <type_traits>
13 
14 namespace mgcpp {
15 template <typename T>
16 struct is_scalar {
17  static const bool value =
18  std::is_arithmetic<T>::value && !std::is_same<T, bool>::value &&
19  !std::is_same<T, char>::value && !std::is_same<T, char16_t>::value &&
20  !std::is_same<T, char32_t>::value && !std::is_same<T, wchar_t>::value &&
21  !std::is_same<T, signed char>::value;
22 };
23 
24 template <typename T>
25 struct is_scalar<std::complex<T>> : std::true_type {};
26 
27 #ifdef USE_HALF
28 template <>
29 struct is_scalar<half> : std::true_type {};
30 #endif
31 } // namespace mgcpp
32 
33 #endif
Definition: adapter_base.hpp:12
std::complex< Type > complex
Definition: complex.hpp:15
Definition: shape.hpp:33
static const bool value
Definition: is_scalar.hpp:17
Definition: is_scalar.hpp:16