Ich versuche eine Python-Klasse mit boost :: python nach C++ zu portieren, um die Ausführung einer Python-Anwendung zu beschleunigen (die Klasse, die ich nach C++ portiere) verantwortlich für ca. 30% der Ausführungszeit der Anwendung.Ich bekomme eine Referenz auf self, wenn ich boost :: python verwende
Die init der ursprünglichen Python-Klasse wie folgt aussieht:
class PyClass(object):
def __init__(self, child):
child.set_parent(self)
...
Wie replizieren ich dies in einem C++ Konstruktor?
wenn ich eine C++ Klasse:
class CClass
{
// to get input args that match the Python class I need
CClass(boost::python::object &child)
{
// but how do I get the boost::python::object self
// as I only have *this in C++ ?
CClass& c = boost::python::extract<CClass&>(child);
c.set_parent(self);
}
...
}
Danke, Mark