Skip to content
Snippets Groups Projects
Unverified Commit 993833df authored by Thorsten Hater's avatar Thorsten Hater Committed by GitHub
Browse files

Sort (in python) the mechanism names. (#1882)

parent e8b242b1
No related branches found
No related tags found
No related merge requests found
......@@ -113,7 +113,9 @@ void register_mechanisms(pybind11::module& m) {
pybind11::class_<arb::mechanism_catalogue> cat(m, "catalogue");
struct mech_cat_iter_state {
mech_cat_iter_state(const arb::mechanism_catalogue &cat_, pybind11::object ref_): names(cat_.mechanism_names()), ref(ref_), cat(cat_) { }
mech_cat_iter_state(const arb::mechanism_catalogue &cat_, pybind11::object ref_): names(cat_.mechanism_names()), ref(ref_), cat(cat_) {
std::sort(names.begin(), names.end());
}
std::vector<std::string> names; // cache the names else these will be allocated multiple times
pybind11::object ref; // keep a reference to cat lest it dies while we iterate
const arb::mechanism_catalogue& cat; // to query the C++ object
......
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