Commit 95932968 authored by Jason Rhinelander's avatar Jason Rhinelander

Stop using implicit-cpp-conversion support

It won't be merged upstream, so work around it for `remove()` by
providing two: one that takes a Member, one that takes an id.
parent 282ef476
......@@ -28,9 +28,9 @@ void bind_simulation(py::module &m) {
}, "Adds a member instance to the simulation. The member is returned, to encourage usage such as: `member = sim.add(MemberObject(...))`")
// Remove can work either by id or on a Member; in eris, Member is implicitly convertible to
// an id, but pybind11 doesn't support that implicit conversion (see pybind11 issue #259),
// so we defined both for the python interface:
// so we define both for the python interface:
.def("remove", &Simulation::remove, "Removes the member with the given id (and any dependencies) from this simulation")
//.def("remove", [](Simulation &s, const Member &m) -> void { s.remove(m.id()); }, "Removes the given member (and any dependencies) from this simulation")
.def("remove", [](Simulation &s, const Member &m) -> void { s.remove(m); }, "Removes the given member (and any dependencies) from this simulation")
// Member filtering. In the C++ interface, you can filter by member sub-type (using a
// template parameter) and by arbitrary lambda function (or both). In the python interface,
......
......@@ -24,8 +24,6 @@ void bind_members(py::module &m) {
.def("_removed", &PyMember<>::removed, "Called immediately after the member has been removed from the simulation. The `.id` and `.simulation` attributes are still available, but the simulation itself no longer references this member. The default implementation does nothing.")
;
py::implicitly_convertible<Member, eris_id_t>();
py::class_<Agent, SharedMember<Agent>, PyAgent<>> agent(m, "Agent", member);
agent
.def(py::init<>())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment