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