diff --git a/src/runner/tuple_helper.h b/src/runner/tuple_helper.h index d9bae07..1d7b8b5 100644 --- a/src/runner/tuple_helper.h +++ b/src/runner/tuple_helper.h @@ -20,14 +20,11 @@ namespace boost { private: - template - static void convert_impl(const TTuple& c_tuple, list& values, std::index_sequence) { - values.append(std::get(c_tuple)); - convert_impl(c_tuple, values, std::index_sequence{}); + template + static void convert_impl(const TTuple& c_tuple, list& values, std::index_sequence) { + (values.append(std::get(c_tuple)), ...); } - static void convert_impl(const TTuple&, list& values, std::index_sequence<>) {} - }; @@ -99,4 +96,4 @@ namespace boost { } } //boost::python -#endif//TUPLES_HPP_16_JAN_2007 \ No newline at end of file +#endif \ No newline at end of file diff --git a/src/runner/variant_helper.h b/src/runner/variant_helper.h index b28c1cc..fe39b83 100644 --- a/src/runner/variant_helper.h +++ b/src/runner/variant_helper.h @@ -30,12 +30,13 @@ namespace boost { struct variant_from_python> { using variant_type = VTemplate; + using index_sequence = std::make_index_sequence>; static void* convertible(PyObject* py_obj) { python::object obj(handle<>(borrowed(py_obj))); - if (impl::convertible(obj)) { + if (convertible_impl(obj)) { return py_obj; } else { @@ -56,29 +57,21 @@ namespace boost { private: + static bool convertible_impl(const python::object& obj) { + return (... || extract(obj).check()); + } + template struct impl; template <> struct impl<> { - static bool convertible(const python::object& obj) { return false; } static void construct(const python::object& obj, variant_type& c_variant) {} }; template struct impl { - static bool convertible(const python::object& obj) { - - extract type_checker(obj); - if (type_checker.check()) { - return true; - } - else { - return impl::convertible(obj); - } - } - static void construct(const python::object& obj, variant_type& c_variant) { extract type_checker(obj);