Skip to content

Recommended approach for binding functions which have an argument with multiple types #758

Answered by wjakob
awni asked this question in Q&A
Discussion options

You must be logged in to vote

They are all good 🤗. It mainly depends on your preference with respect to function signatures in tooling.

If you have a function with many overloads and many arguments (or few, but ones that are costly to cast, e.g. list -> std::vector<int> with big lists), then its likely cheaper to crunch it down to a single overload and work out the specific way to handle each argument in C++. Otherwise, nanobind will try the overloads one by one, which may involve some redundant type casting overheads.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by awni
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