@@ -58,11 +58,11 @@ template <typename T>
5858 }
5959}
6060
61- #define PLSSVM_CREATE_PYARRAY_T_TO_VECTOR_MAPPINGS (data_type ) \
62- if constexpr (detail::is_label_type_in_variant_v<std::vector< data_type> , possible_vector_types>) { \
63- if (type.equal (py::dtype::of<data_type>())) { \
64- return pyarray_t_to_vector<data_type>(vec); \
65- } \
61+ #define PLSSVM_CREATE_PYARRAY_T_TO_VECTOR_MAPPINGS (data_type ) \
62+ if constexpr (detail::is_label_type_in_variant_v<data_type, possible_vector_types>) { \
63+ if (type.equal (py::dtype::of<data_type>())) { \
64+ return pyarray_t_to_vector<data_type>(vec); \
65+ } \
6666 }
6767
6868/* *
@@ -92,7 +92,7 @@ template <typename possible_vector_types>
9292 PLSSVM_CREATE_PYARRAY_T_TO_VECTOR_MAPPINGS (float )
9393 PLSSVM_CREATE_PYARRAY_T_TO_VECTOR_MAPPINGS (double )
9494
95- if constexpr (detail::is_label_type_in_variant_v<std::vector<std:: string> , possible_vector_types>) {
95+ if constexpr (detail::is_label_type_in_variant_v<std::string, possible_vector_types>) {
9696 if (type.attr (" kind" ).cast <std::string>() == " U" ) {
9797 // convert py::array of strings to a std::vector<std::string>
9898 if (vec.ndim () != 1 ) {
@@ -158,11 +158,11 @@ struct py_type_equal {
158158
159159} // namespace impl
160160
161- #define PLSSVM_CREATE_PYLIST_TO_VECTOR_MAPPINGS (np_data_type, cpp_data_type ) \
162- if constexpr (detail::is_label_type_in_variant_v<std::vector< cpp_data_type> , possible_vector_types>) { \
163- if (highest_type.equal (np.attr (np_data_type))) { \
164- return std::make_pair (pylist_to_vector<cpp_data_type>(list), py::dtype::of<cpp_data_type>()); \
165- } \
161+ #define PLSSVM_CREATE_PYLIST_TO_VECTOR_MAPPINGS (np_data_type, cpp_data_type ) \
162+ if constexpr (detail::is_label_type_in_variant_v<cpp_data_type, possible_vector_types>) { \
163+ if (highest_type.equal (np.attr (np_data_type))) { \
164+ return std::make_pair (pylist_to_vector<cpp_data_type>(list), py::dtype::of<cpp_data_type>()); \
165+ } \
166166 }
167167
168168/* *
@@ -218,22 +218,22 @@ template <typename possible_vector_types>
218218 PLSSVM_CREATE_PYLIST_TO_VECTOR_MAPPINGS (" float32" , float )
219219 PLSSVM_CREATE_PYLIST_TO_VECTOR_MAPPINGS (" float64" , double )
220220
221- if constexpr (detail::is_label_type_in_variant_v<std::vector< bool > , possible_vector_types>) {
221+ if constexpr (detail::is_label_type_in_variant_v<bool , possible_vector_types>) {
222222 if (highest_type.equal (py::module_::import (" builtins" ).attr (" bool" ))) {
223223 return std::make_pair (pylist_to_vector<bool >(list), py::dtype::of<bool >());
224224 }
225225 }
226- if constexpr (detail::is_label_type_in_variant_v<std::vector<std:: int64_t > , possible_vector_types>) {
226+ if constexpr (detail::is_label_type_in_variant_v<std::int64_t , possible_vector_types>) {
227227 if (highest_type.equal (py::module_::import (" builtins" ).attr (" int" ))) {
228228 return std::make_pair (pylist_to_vector<std::int64_t >(list), py::dtype::of<std::int64_t >());
229229 }
230230 }
231- if constexpr (detail::is_label_type_in_variant_v<std::vector< double > , possible_vector_types>) {
231+ if constexpr (detail::is_label_type_in_variant_v<double , possible_vector_types>) {
232232 if (highest_type.equal (py::module_::import (" builtins" ).attr (" float" ))) {
233233 return std::make_pair (pylist_to_vector<double >(list), py::dtype::of<double >());
234234 }
235235 }
236- if constexpr (detail::is_label_type_in_variant_v<std::vector<std:: string> , possible_vector_types>) {
236+ if constexpr (detail::is_label_type_in_variant_v<std::string, possible_vector_types>) {
237237 if (highest_type.equal (py::module_::import (" builtins" ).attr (" str" ))) {
238238 return std::make_pair (pylist_to_vector<std::string>(list), py::dtype (" U" ));
239239 }
0 commit comments