Skip to content

Looking for boilerplate reduction in my function binding code #964

Answered by oremanj
nurpax asked this question in Q&A
Discussion options

You must be logged in to vote

I wonder if there's a better way to express this, without having to write those lambda wrappers for each API function that uses flags like above?

C++ template metaprogramming can't tell the difference between a typedef and the type that it expands to. If you can't change the underlying library to use a stronger type for these flags arguments, then it's sort of fundamentally impossible for nanobind to tell what's going on on its own.

C++ template metaprogramming also can't tell the argument names of a function, so any option that is less boilerplate-y would lose those in the bindings.

If the signatures for these functions are relatively consistent, such as if the flags argument is always…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nurpax
Comment options

Answer selected by nurpax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants