From a72f898ff4c4237424c468044a6db9d6953b541e Mon Sep 17 00:00:00 2001 From: gatecat Date: Wed, 14 Sep 2022 09:28:47 +0200 Subject: 3rdparty: Bump vendored pybind11 version for py3.11 support Signed-off-by: gatecat --- 3rdparty/pybind11/tests/test_stl.cpp | 403 +++++++++++++++++++++++++++-------- 1 file changed, 315 insertions(+), 88 deletions(-) (limited to '3rdparty/pybind11/tests/test_stl.cpp') diff --git a/3rdparty/pybind11/tests/test_stl.cpp b/3rdparty/pybind11/tests/test_stl.cpp index 05901627..d45465d6 100644 --- a/3rdparty/pybind11/tests/test_stl.cpp +++ b/3rdparty/pybind11/tests/test_stl.cpp @@ -7,22 +7,44 @@ BSD-style license that can be found in the LICENSE file. */ -#include "pybind11_tests.h" -#include "constructor_stats.h" #include -#include +#include "constructor_stats.h" +#include "pybind11_tests.h" + +#ifndef PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL +# define PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL +#endif +#include + #include +#include + +#if defined(PYBIND11_TEST_BOOST) +# include + +namespace PYBIND11_NAMESPACE { +namespace detail { +template +struct type_caster> : optional_caster> {}; + +template <> +struct type_caster : void_caster {}; +} // namespace detail +} // namespace PYBIND11_NAMESPACE +#endif // Test with `std::variant` in C++17 mode, or with `boost::variant` in C++11/14 #if defined(PYBIND11_HAS_VARIANT) using std::variant; -#elif defined(PYBIND11_TEST_BOOST) && (!defined(_MSC_VER) || _MSC_VER >= 1910) -# include -# define PYBIND11_HAS_VARIANT 1 +# define PYBIND11_TEST_VARIANT 1 +#elif defined(PYBIND11_TEST_BOOST) +# include +# define PYBIND11_TEST_VARIANT 1 using boost::variant; -namespace pybind11 { namespace detail { +namespace PYBIND11_NAMESPACE { +namespace detail { template struct type_caster> : variant_caster> {}; @@ -33,33 +55,117 @@ struct visit_helper { return boost::apply_visitor(args...); } }; -}} // namespace pybind11::detail +} // namespace detail +} // namespace PYBIND11_NAMESPACE #endif PYBIND11_MAKE_OPAQUE(std::vector>); /// Issue #528: templated constructor struct TplCtorClass { - template TplCtorClass(const T &) { } + template + explicit TplCtorClass(const T &) {} bool operator==(const TplCtorClass &) const { return true; } }; namespace std { - template <> - struct hash { size_t operator()(const TplCtorClass &) const { return 0; } }; +template <> +struct hash { + size_t operator()(const TplCtorClass &) const { return 0; } +}; } // namespace std - template