-
With #include <nanobind/nanobind.h>
struct test_struct { int some_date; };
NB_MODULE(nanobind_example_ext, m) {
nanobind::class_<test_struct>(m, "test_struct")
.def(nanobind::init([]() -> test_struct { return {.some_date=1}; }));
} Fails to compile:
Is this a removed functionality, or am I making some silly mistake? |
Beta Was this translation helpful? Give feedback.
Answered by
wjakob
May 2, 2022
Replies: 1 comment 2 replies
-
Good catch. This is an area where the syntax differs from pybind11, which wasn't documented. Please see the README.md file at https://github.com/wjakob/nanobind, specifically the section on "Custom constructors" |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
wjakob
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good catch. This is an area where the syntax differs from pybind11, which wasn't documented.
Please see the README.md file at https://github.com/wjakob/nanobind, specifically the section on "Custom constructors"