-
Hello, this is a very easy scenario when I wrote below code, an assert raised: terminate called after throwing an instance of 'pybind11::cast_error' I am using C++17, so std::optional is supported. #include <pybind11/pybind11.h>
#include <pybind11/embed.h>
#include <optional>
namespace py=pybind11;
int main() {
py::scoped_interpreter guard{};
std::optional<int> a;
py::print(a);
} It looks I need to copy the optional caster from stl.h to cast.h and it works, is there a better solution? Similar issues happened when I put a customer type whose bind have been defined.
The range instance can be casted to a python object while the std::vector<Range> failed to cast. Hope any one can help, thanks so much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Resolved. |
Beta Was this translation helpful? Give feedback.
Resolved.