Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pybind functionality enabled by c++14 #4137

Open
mormj opened this issue Jan 22, 2021 · 1 comment
Open

Use pybind functionality enabled by c++14 #4137

mormj opened this issue Jan 22, 2021 · 1 comment
Labels
enhancement Low Issues of low priority. pybind11
Milestone

Comments

@mormj
Copy link
Contributor

mormj commented Jan 22, 2021

Since our pybind11 integrations were developed when master was still on c++11, we missed out on some of the syntactical niceties such as:

https://pybind11.readthedocs.io/en/stable/classes.html?highlight=overloaded#overloaded-methods

where

py::class_<Pet>(m, "Pet")
   .def(py::init<const std::string &, int>())
   .def("set", static_cast<void (Pet::*)(int)>(&Pet::set), "Set the pet's age")
   .def("set", static_cast<void (Pet::*)(const std::string &)>(&Pet::set), "Set the pet's name");

becomes

py::class_<Pet>(m, "Pet")
    .def("set", py::overload_cast<int>(&Pet::set), "Set the pet's age")
    .def("set", py::overload_cast<const std::string &>(&Pet::set), "Set the pet's name");

This can be done in the in-tree bindings, but more importantly should be updated in the modtool template and bindtool

@mormj mormj added the pybind11 label Jan 22, 2021
@mormj mormj added this to the 3.10.0.0 milestone Mar 9, 2021
@mormj mormj added this to To do in Release 3.11 via automation Jan 20, 2022
@mormj mormj moved this from To do to Proposed in Release 3.11 Jan 20, 2022
@marcusmueller
Copy link
Member

marcusmueller commented Jan 28, 2024

we're doing this here and there in the tree right now! ❤️

I don't think we'll spend energy on converting the existing codebase to do it everywhere, though.

@marcusmueller marcusmueller added Low Issues of low priority. and removed Triage::needed labels Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Low Issues of low priority. pybind11
Projects
Development

No branches or pull requests

3 participants