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

nb::typed<>: support use in return position #174

Merged
merged 1 commit into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/api_core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2130,11 +2130,12 @@ Miscellaneous

.. cpp:struct:: template <typename T, typename D> typed

This helper class provides an an API for overriding the type annotation of
a function argument in generated docstrings. It is particularly helpful
when the type signature is not obvious and must be computed at compile time.
Otherwise, the :cpp:class:`raw_doc` attribute provides a simpler
alternative for taking full control of docstrings and type annotations.
This helper class provides an an API for overriding the type
annotation of a function argument or return value in generated
docstrings. It is particularly helpful when the type signature is
not obvious and must be computed at compile time. Otherwise, the
:cpp:class:`raw_doc` attribute provides a simpler alternative for
taking full control of docstrings and type annotations.

Consider the following binding that iterates over a Python list.

Expand Down
2 changes: 1 addition & 1 deletion include/nanobind/nb_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ template <typename T, typename X> struct type_caster<typed<T, X>> {
return true;
}

static handle from_cpp(const T &src, rv_policy policy,
static handle from_cpp(const T2 &src, rv_policy policy,
cleanup_list *cleanup) noexcept {
return Caster::from_cpp(src.value, policy, cleanup);
}
Expand Down