-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
It would be unbelievably nice to use the core objects in other projects without being married to the Python bindings.
A potential refactor could look something like:
// Current
template<class Stuff>
struct Thing {
// Blah...
static void Build(py::module& m, const char* name) {
auto obj = py::class_<Thing<Stuff>>(m, name);
// more stuff
Base::DenseBaseBuild(obj);
};
static void BuildThings(py::module& m) {
Thing<Wow>::Build(m, "ThingWow");
Thing<Fake>::Build(m, "ThingFake");
}becomes
// Proposed
#include "Thing.h"
#include "BuildDenseBase.h"
template<class Stuff>
static void BuildThing(py::module& m, const char* name) {
auto obj = py::class_<Thing<Stuff>>(m, name);
// You already know
BuildDenseBase<Thing<Stuff>>(obj);
}
static void BuildThings(py::module& m) {
BuildThing<Wow>(m, "ThingWow");
BuildThing<Fake>(m, "ThingFake");
}This way, you'd have a totally separate folder (I like calling it bind) that only contains a bunch of these BuildWhatever functions. The core implementations wouldn't know about the bindings at all.
Really just flipping it all inside-out.
jbpezent and rsood111
Metadata
Metadata
Assignees
Labels
No labels