From fafd76ee512fc4081fec71817e82357ffde24fdc Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 28 Oct 2000 17:24:32 +0000 Subject: [PATCH] Test that we can now pass non-const reference parameters to constructors [SVN r8041] --- extclass_demo.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extclass_demo.cpp b/extclass_demo.cpp index 0334e0cd..42c06922 100644 --- a/extclass_demo.cpp +++ b/extclass_demo.cpp @@ -524,6 +524,12 @@ struct StandardOps static T cmp(const T& x, const T& y) { return std::less()(x, y) ? -1 : std::less()(y, x) ? 1 : 0; } }; +// This helps us prove that we can now pass non-const reference parameters to constructors +struct Fubar { + Fubar(Foo&) {} + Fubar(int) {} +}; + /************************************************************/ /* */ /* init the module */ @@ -532,6 +538,10 @@ struct StandardOps void init_module(py::Module& m) { + py::ClassWrapper fubar(m, "Fubar"); + fubar.def(py::Constructor()); + fubar.def(py::Constructor()); + m.add(new Foo::PythonClass); m.add(new BarPythonClass); m.add(new BazPythonClass);