NumCpp  2.6.2
A Templatized Header Only C++ Implementation of the Python NumPy Library
StaticAsserts.hpp
Go to the documentation of this file.
1 
28 #pragma once
29 
31 
32 #include <type_traits>
33 
34 #define STATIC_ASSERT_VALID_DTYPE(dtype) \
35  static_assert(nc::is_valid_dtype_v<dtype>, "Template type is not a valid dtype for NdArray")
36 
37 #define STATIC_ASSERT_ARITHMETIC(dtype) \
38  static_assert(is_arithmetic_v<dtype>, "Can only be used with arithmetic types")
39 
40 #define STATIC_ASSERT_INTEGER(dtype) \
41  static_assert(is_integral_v<dtype>, "Can only be used with integer types")
42 
43 #define STATIC_ASSERT_FLOAT(dtype) \
44  static_assert(is_floating_point_v<dtype>, "Can only be used with float types")
45 
46 #define STATIC_ASSERT_COMPLEX(dtype) \
47  static_assert(is_complex_v<dtype>, \
48  "Can only be used with std::complex types")
49 
50 #define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype) \
51  static_assert(std::is_arithmetic<dtype>::value || is_complex_v<dtype>, \
52  "Can only be used with arithmetic types or std::complex types")