You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
// Currenttemplate<classStuff>
structThing {
// Blah...staticvoidBuild(py::module& m, constchar* name) {
auto obj = py::class_<Thing<Stuff>>(m, name);
// more stuffBase::DenseBaseBuild(obj);
};
staticvoidBuildThings(py::module& m) {
Thing<Wow>::Build(m, "ThingWow");
Thing<Fake>::Build(m, "ThingFake");
}
becomes
// Proposed
#include"Thing.h"
#include"BuildDenseBase.h"template<classStuff>
staticvoidBuildThing(py::module& m, constchar* name) {
auto obj = py::class_<Thing<Stuff>>(m, name);
// You already know
BuildDenseBase<Thing<Stuff>>(obj);
}
staticvoidBuildThings(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.
The text was updated successfully, but these errors were encountered:
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:
becomes
This way, you'd have a totally separate folder (I like calling it
bind
) that only contains a bunch of theseBuildWhatever
functions. The core implementations wouldn't know about the bindings at all.Really just flipping it all inside-out.
The text was updated successfully, but these errors were encountered: