[C++-sig] Wrapping a non-copyiable static instance in bp::object
Michael Wild
themiwi at users.sourceforge.net
Wed Jan 16 21:00:09 CET 2013
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::object(A::static_a); // [1]
return *result;
}
Wrapping A and static_instance with Boost.Python is no problem, and
everything works as expected, however the A::static_a that is being
passed to bp::object() at [1] is being copied, which defeats the whole
purpose.
Anybody has an idea how achieve this? Thanks!
Cheers
Michael
More information about the Cplusplus-sig
mailing list