Allow passing base types as a template parameter
This allows a slightly cleaner base type specification of:
py::class_<Type, Base>("Type")
as an alternative to
py::class_<Type>("Type", py::base<Base>())
As with the other template parameters, the order relative to the holder
or trampoline types doesn't matter.
This also includes a compile-time assertion failure if attempting to
specify more than one base class (but is easily extendible to support
multiple inheritance, someday, by updating the class_selector::set_bases
function to set multiple bases).
diff --git a/tests/test_issues.cpp b/tests/test_issues.cpp
index 0a5a0b0..55502fe 100644
--- a/tests/test_issues.cpp
+++ b/tests/test_issues.cpp
@@ -96,7 +96,7 @@
py::class_<ElementBase, std::shared_ptr<ElementBase>> (m2, "ElementBase");
- py::class_<ElementA, std::shared_ptr<ElementA>>(m2, "ElementA", py::base<ElementBase>())
+ py::class_<ElementA, ElementBase, std::shared_ptr<ElementA>>(m2, "ElementA")
.def(py::init<int>())
.def("value", &ElementA::value);