We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The Type Caster for STL std::vector<bool> is not working due to the following range based for loop:
std::vector<bool>
nanobind/include/nanobind/stl/detail/nb_list.h
Line 62 in 90b2677
See https://stackoverflow.com/a/34085592/9759769.
An example demonstrating the error would be:
#include <nanobind/nanobind.h> #include <nanobind/stl/vector.h> #include <vector> namespace nb = nanobind; using namespace nb::literals; // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables, misc-use-anonymous-namespace, readability-identifier-length) NB_MODULE(nanobind_example_ext, m) { m.def("vector_bool", []() { return std::vector<bool>{false, true, false, true}; }); }
which yields on GCC 12.3.0:
[build] /nanobind_example/.venv/lib/python3.11/site-packages/nanobind/include/nanobind/stl/detail/nb_list.h:62:13: error: cannot bind non-const lvalue reference of type ‘std::_Bit_reference&’ to an rvalue of type ‘std::_Bit_iterator::reference’ [build] 62 | for (auto &value : src) { [build] | ^~~ [build] ninja: build stopped: subcommand failed.
The text was updated successfully, but these errors were encountered:
Update nb_list.h to allow for std::vector<bool>, see wjakob#255
6a2ae30
Update nb_list.h to allow for std::vector<bool>, see #255 (#256)
a0d26d2
* Update nb_list.h to allow for std::vector<bool>, see #255 * Added type caster test for std::vector<bool> * Fixed test name
Closed via #256.
Sorry, something went wrong.
No branches or pull requests
The Type Caster for STL
std::vector<bool>
is not working due to the following range based for loop:nanobind/include/nanobind/stl/detail/nb_list.h
Line 62 in 90b2677
See https://stackoverflow.com/a/34085592/9759769.
An example demonstrating the error would be:
which yields on GCC 12.3.0:
The text was updated successfully, but these errors were encountered: