Skip to content

Conversation

@ManifoldFR
Copy link
Member

This PR adds a C++11 user-defined literal which is used as a shortcut for bp::arg(name).

The same literal already exists in both pybind11 and nanobind. I also have a version of this for internal use in aligator's bindings.

Users can replace bp::arg("truc") by "truc"_a, after importing the operator into the current scope, or using the simpler using namespace eigenpy::literals.

Usage:

void my_fun(int x, int y, int z = 42)
{
    // do stuff
}
// ...
// in module definition:

using namespace eigenpy::literals;

bp::def("my_fun", my_fun, ("x"_a, "y", "z"_a = 42));

nim65s
nim65s previously approved these changes Apr 25, 2025
jorisv
jorisv previously approved these changes Apr 25, 2025
jcarpent
jcarpent previously approved these changes Apr 25, 2025
@ManifoldFR ManifoldFR dismissed stale reviews from jcarpent, jorisv, and nim65s via d43b83c April 25, 2025 12:59
@ManifoldFR ManifoldFR force-pushed the topic/add-arg-literal branch from 8a05a6f to d43b83c Compare April 25, 2025 12:59
@ManifoldFR
Copy link
Member Author

In concert with @jorisv, we are using this PR to remove ubuntu 20.04 from the CI, and adding 24.04 instead.

I think you would approve @nim65s ? this would gel with your latest messages on matrix 😃

@ManifoldFR ManifoldFR enabled auto-merge April 25, 2025 13:27
@ManifoldFR ManifoldFR merged commit b32a02c into stack-of-tasks:devel Apr 25, 2025
32 checks passed
@ManifoldFR ManifoldFR deleted the topic/add-arg-literal branch April 25, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants