@@ -24,7 +24,7 @@ struct MyVirtualClass {
2424};
2525
2626struct MyVirtualData {
27- MyVirtualData (MyVirtualClass const &) {}
27+ MyVirtualData (MyVirtualClass const &) {}
2828 virtual ~MyVirtualData () {} // virtual dtor to mark class as polymorphic
2929};
3030
@@ -84,8 +84,9 @@ struct VirtualClassWrapper : MyVirtualClass, bp::wrapper<MyVirtualClass> {
8484// / This "trampoline class" does nothing but is ABSOLUTELY required to ensure
8585// / downcasting works properly with non-smart ptr signatures. Otherwise,
8686// / there is no handle to the original Python object ( @c PyObject *).
87- // / Every single polymorphic type exposed to Python should be exposed through such a trampoline.
88- // / Users can also create their own wrapper classes by taking inspiration from boost::python::wrapper<T>.
87+ // / Every single polymorphic type exposed to Python should be exposed through
88+ // / such a trampoline. Users can also create their own wrapper classes by taking
89+ // / inspiration from boost::python::wrapper<T>.
8990struct DataWrapper : MyVirtualData, bp::wrapper<MyVirtualData> {
9091 // / we have to use-declare non-defaulted constructors
9192 // / (see https://en.cppreference.com/w/cpp/language/default_constructor)
@@ -99,7 +100,8 @@ const MyVirtualData &iden_ref(const MyVirtualData &d) {
99100 return d;
100101}
101102
102- // / Take a shared_ptr (by const reference or value, doesn't matter), return by const reference
103+ // / Take a shared_ptr (by const reference or value, doesn't matter), return by
104+ // / const reference
103105const MyVirtualData &iden_shared (const shared_ptr<MyVirtualData> &d) {
104106 // get boost.python's custom deleter
105107 // boost.python hides the handle to the original object in there
@@ -136,7 +138,7 @@ BOOST_PYTHON_MODULE(bind_virtual_factory) {
136138 // / otherwise if passed as "HeldType", we need to define
137139 // / the constructor and call initializer manually.
138140 bp::class_<DataWrapper, boost::noncopyable>(" MyVirtualData" , bp::no_init)
139- .def (bp::init<MyVirtualClass const &>(bp::args (" self" , " model" )));
141+ .def (bp::init<MyVirtualClass const &>(bp::args (" self" , " model" )));
140142
141143 bp::def (" callDoSomethingPtr" , callDoSomethingPtr, bp::args (" obj" ));
142144 bp::def (" callDoSomethingRef" , callDoSomethingRef, bp::args (" obj" ));
0 commit comments