NumCpp  2.9.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
StaticAsserts.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include <type_traits>
31 
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(nc::is_arithmetic_v<dtype>, "Can only be used with arithmetic types")
39 
40 #define STATIC_ASSERT_INTEGER(dtype) static_assert(nc::is_integral_v<dtype>, "Can only be used with integer types")
41 
42 #define STATIC_ASSERT_UNSIGNED_INTEGER(dtype) \
43  static_assert(nc::is_integral_v<dtype> && nc::is_unsigned_v<dtype>, "Can only be used with integer types")
44 
45 #define STATIC_ASSERT_FLOAT(dtype) static_assert(nc::is_floating_point_v<dtype>, "Can only be used with float types")
46 
47 #define STATIC_ASSERT_COMPLEX(dtype) static_assert(nc::is_complex_v<dtype>, "Can only be used with std::complex types")
48 
49 #define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype) \
50  static_assert(nc::is_arithmetic_v<dtype> || nc::is_complex_v<dtype>, \
51  "Can only be used with arithmetic types or std::complex types")