Skip to content

Commit 1c8795a

Browse files
committed
Changing PYBIND11_SMART_HOLDER_TYPE_CASTERS to use __VA_ARGS__.
1 parent ab590c6 commit 1c8795a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

include/pybind11/detail/smart_holder_type_casters.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -773,28 +773,28 @@ struct smart_holder_type_caster<std::unique_ptr<T const, D>>
773773

774774
#ifndef PYBIND11_USE_SMART_HOLDER_AS_DEFAULT
775775

776-
# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) \
776+
# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(...) \
777777
namespace pybind11 { \
778778
namespace detail { \
779779
template <> \
780-
class type_caster<T> : public smart_holder_type_caster<T> {}; \
780+
class type_caster<__VA_ARGS__> : public smart_holder_type_caster<__VA_ARGS__> {}; \
781781
template <> \
782-
class type_caster<std::shared_ptr<T>> \
783-
: public smart_holder_type_caster<std::shared_ptr<T>> {}; \
782+
class type_caster<std::shared_ptr<__VA_ARGS__>> \
783+
: public smart_holder_type_caster<std::shared_ptr<__VA_ARGS__>> {}; \
784784
template <> \
785-
class type_caster<std::shared_ptr<T const>> \
786-
: public smart_holder_type_caster<std::shared_ptr<T const>> {}; \
785+
class type_caster<std::shared_ptr<__VA_ARGS__ const>> \
786+
: public smart_holder_type_caster<std::shared_ptr<__VA_ARGS__ const>> {}; \
787787
template <typename D> \
788-
class type_caster<std::unique_ptr<T, D>> \
789-
: public smart_holder_type_caster<std::unique_ptr<T, D>> {}; \
788+
class type_caster<std::unique_ptr<__VA_ARGS__, D>> \
789+
: public smart_holder_type_caster<std::unique_ptr<__VA_ARGS__, D>> {}; \
790790
template <typename D> \
791-
class type_caster<std::unique_ptr<T const, D>> \
792-
: public smart_holder_type_caster<std::unique_ptr<T const, D>> {}; \
791+
class type_caster<std::unique_ptr<__VA_ARGS__ const, D>> \
792+
: public smart_holder_type_caster<std::unique_ptr<__VA_ARGS__ const, D>> {}; \
793793
} \
794794
}
795795
#else
796796

797-
# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(T)
797+
# define PYBIND11_SMART_HOLDER_TYPE_CASTERS(...)
798798

799799
template <typename T>
800800
class type_caster_for_class_ : public smart_holder_type_caster<T> {};

include/pybind11/smart_holder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
1212

13-
// Supports easier switching between py::class_<U> and py::class_<U, py::smart_holder>:
13+
// Supports easier switching between py::class_<T> and py::class_<T, py::smart_holder>:
1414
// users can simply replace the `_` in `class_` with `h` or vice versa.
15-
// Note though that the PYBIND11_SMART_HOLDER_TYPE_CASTERS(U) macro also needs to be
16-
// added (for `classh`) or commented out (for `class_`).
15+
// Note though that the PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) macro also needs to be
16+
// added (for `classh`) or commented out (when falling back to `class_`).
1717
template <typename type_, typename... options>
1818
class classh : public class_<type_, smart_holder, options...> {
1919
public:

0 commit comments

Comments
 (0)