|
11 | 11 | #include <boost/python/numpy/internal.hpp> |
12 | 12 |
|
13 | 13 | #define DTYPE_FROM_CODE(code) \ |
14 | | - dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code)))) |
| 14 | + dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code)))) |
15 | 15 |
|
16 | 16 | #define BUILTIN_INT_DTYPE(bits) \ |
17 | | - template <> struct builtin_int_dtype< bits, false > { \ |
18 | | - static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits); } \ |
19 | | - }; \ |
20 | | - template <> struct builtin_int_dtype< bits, true > { \ |
21 | | - static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits); } \ |
22 | | - }; \ |
23 | | - template dtype get_int_dtype< bits, false >(); \ |
24 | | - template dtype get_int_dtype< bits, true >() |
| 17 | + template <> struct builtin_int_dtype<bits, false> \ |
| 18 | + { \ |
| 19 | + static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits);} \ |
| 20 | + }; \ |
| 21 | + template <> struct builtin_int_dtype<bits, true> \ |
| 22 | + { \ |
| 23 | + static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits);} \ |
| 24 | + }; \ |
| 25 | + template BOOST_NUMPY_DECL dtype get_int_dtype<bits, false>(); \ |
| 26 | + template BOOST_NUMPY_DECL dtype get_int_dtype<bits, true>() |
25 | 27 |
|
26 | 28 | #define BUILTIN_FLOAT_DTYPE(bits) \ |
27 | | - template <> struct builtin_float_dtype< bits > { \ |
28 | | - static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits); } \ |
29 | | - }; \ |
30 | | - template dtype get_float_dtype< bits >() |
| 29 | + template <> struct builtin_float_dtype<bits> \ |
| 30 | + { \ |
| 31 | + static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits);} \ |
| 32 | + }; \ |
| 33 | + template BOOST_NUMPY_DECL dtype get_float_dtype<bits>() |
31 | 34 |
|
32 | 35 | #define BUILTIN_COMPLEX_DTYPE(bits) \ |
33 | | - template <> struct builtin_complex_dtype< bits > { \ |
34 | | - static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits); } \ |
35 | | - }; \ |
36 | | - template dtype get_complex_dtype< bits >() |
| 36 | + template <> struct builtin_complex_dtype<bits> \ |
| 37 | + { \ |
| 38 | + static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits);} \ |
| 39 | + }; \ |
| 40 | + template BOOST_NUMPY_DECL dtype get_complex_dtype<bits>() |
37 | 41 |
|
38 | 42 | namespace boost { namespace python { namespace converter { |
39 | 43 | NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArrayDescr_Type, numpy::dtype) |
|
0 commit comments