diff --git a/include/pybind11/detail/smart_holder_type_casters.h b/include/pybind11/detail/smart_holder_type_casters.h index 97791ceb12..84fd64e1a7 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 7a185f7692..bf7cfb9dda 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: