diff --git a/extclass_demo.cpp b/extclass_demo.cpp index 331d7371..7efaff69 100644 --- a/extclass_demo.cpp +++ b/extclass_demo.cpp @@ -516,14 +516,14 @@ const char* call_overrideA1(const A1& a) { return a.overrideA1(); } const char* call_overrideB1(const B1& b) { return b.overrideB1(); } const char* call_inheritA1(const A1& a) { return a.inheritA1(); } -auto_ptr factoryA1asA1() { return auto_ptr(new A1); } -auto_ptr factoryB1asA1() { return auto_ptr(new B1); } -auto_ptr factoryB2asA1() { return auto_ptr(new B2); } -auto_ptr factoryCasA1() { return auto_ptr(new C); } -auto_ptr factoryA2asA2() { return auto_ptr(new A2); } -auto_ptr factoryB1asA2() { return auto_ptr(new B1); } -auto_ptr factoryB1asB1() { return auto_ptr(new B1); } -auto_ptr factoryCasB1() { return auto_ptr(new C); } +std::auto_ptr factoryA1asA1() { return std::auto_ptr(new A1); } +std::auto_ptr factoryB1asA1() { return std::auto_ptr(new B1); } +std::auto_ptr factoryB2asA1() { return std::auto_ptr(new B2); } +std::auto_ptr factoryCasA1() { return std::auto_ptr(new C); } +std::auto_ptr factoryA2asA2() { return std::auto_ptr(new A2); } +std::auto_ptr factoryB1asA2() { return std::auto_ptr(new B1); } +std::auto_ptr factoryB1asB1() { return std::auto_ptr(new B1); } +std::auto_ptr factoryCasB1() { return std::auto_ptr(new C); } struct B_callback : B1 { B_callback(PyObject* self) : m_self(self) {} @@ -607,10 +607,14 @@ struct Fubar { /************************************************************/ /* */ -/* This test from Mark Evans */ +/* double tests from Mark Evans() */ /* */ /************************************************************/ double sizelist(py::List list) { return list.size(); } +void vd_push_back(std::vector& vd, const double& x) +{ + vd.push_back(x); +} /************************************************************/ /* */ @@ -622,6 +626,10 @@ void init_module(py::Module& m) { m.def(sizelist, "sizelist"); + py::ClassWrapper > vector_double(m, "vector_double"); + vector_double.def(py::Constructor<>()); + vector_double.def(vd_push_back, "push_back"); + py::ClassWrapper fubar(m, "Fubar"); fubar.def(py::Constructor()); fubar.def(py::Constructor());