Re: [C++-sig] Wrapping a non-copyiable static instance in bp::object

2013-01-16 Thread Wojciech Mamrak
Hi, bp::object static_instance() { static bp::object* result = new bp::object(boost::ref(A::static_a)); return *result; } Instead of exposing a function static_instance in your module, you can alternatively add a variable to your module's scope: scope sc; sc.attr("static_a") = boost::ref(A::

[C++-sig] Wrapping a non-copyiable static instance in bp::object

2013-01-16 Thread Michael Wild
Dear all I struggle to find a way in which I can wrap a static instance in a bp::object without copying it. The goal is to have object identity for this static instance: struct A { /*...*/ static A static_a; }; a A::a; bp::object static_instance() { static bp::object* result = new bp::obj