From 1c8795a2050dff364688ef802064358f9dca3d3a Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 15 Apr 2021 09:05:22 -0700 Subject: [PATCH] Changing PYBIND11_SMART_HOLDER_TYPE_CASTERS to use __VA_ARGS__. --- .../detail/smart_holder_type_casters.h | 22 +++++++++---------- include/pybind11/smart_holder.h | 6 ++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/pybind11/detail/smart_holder_type_casters.h b/include/pybind11/detail/smart_holder_type_casters.h index 97791ceb1..84fd64e1a 100644 --- a/include/pybind11/detail/smart_holder_type_casters.h +++ b/include/pybind11/detail/smart_holder_type_casters.h @@ -773,28 +773,28 @@ struct smart_holder_type_caster> #ifndef PYBIND11_USE_SMART_HOLDER_AS_DEFAULT -# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) \ +# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(...) \ namespace pybind11 { \ namespace detail { \ template <> \ - class type_caster : public smart_holder_type_caster {}; \ + class type_caster<__VA_ARGS__> : public smart_holder_type_caster<__VA_ARGS__> {}; \ template <> \ - class type_caster> \ - : public smart_holder_type_caster> {}; \ + class type_caster> \ + : public smart_holder_type_caster> {}; \ template <> \ - class type_caster> \ - : public smart_holder_type_caster> {}; \ + class type_caster> \ + : public smart_holder_type_caster> {}; \ template \ - class type_caster> \ - : public smart_holder_type_caster> {}; \ + class type_caster> \ + : public smart_holder_type_caster> {}; \ template \ - class type_caster> \ - : public smart_holder_type_caster> {}; \ + class type_caster> \ + : public smart_holder_type_caster> {}; \ } \ } #else -# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) +# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(...) template class type_caster_for_class_ : public smart_holder_type_caster {}; diff --git a/include/pybind11/smart_holder.h b/include/pybind11/smart_holder.h index 7a185f769..bf7cfb9dd 100644 --- a/include/pybind11/smart_holder.h +++ b/include/pybind11/smart_holder.h @@ -10,10 +10,10 @@ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) -// Supports easier switching between py::class_ and py::class_: +// Supports easier switching between py::class_ and py::class_: // users can simply replace the `_` in `class_` with `h` or vice versa. -// Note though that the PYBIND11_SMART_HOLDER_TYPE_CASTERS(U) macro also needs to be -// added (for `classh`) or commented out (for `class_`). +// Note though that the PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) macro also needs to be +// added (for `classh`) or commented out (when falling back to `class_`). template class classh : public class_ { public: