Open funchal opened 6 years ago
Hi @funchal ,
This sounds reasonable to me. Do you want to create a PR? (please also mention this in the documentation and the changelog file).
Best, Wenzel
Here you go: https://github.com/pybind/pybind11/pull/1210
Quick reminder, there is still interest in resolving this issue. stl.h
has too much stuff in it some of it I want and some I don't. I currently have to workaround this would be great to get some solution in place.
I'd like to propose that we:
std::optional
andstd::variant
conversion support, which are currently inpybind11/stl.h
, to a new file (saypybind11/utility.h
since they are in the STL utility library in C++17).pybind11/utility.h
frompybind11/stl.h
so that we maintain full backward compatibility.My motivation for this proposal is that the conversion for other containers (set/vector/map) in
pybind11/stl.h
comes with a major downside, documented in http://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html#automatic-conversion, and I believe that optional/variant can be useful in their own right.If you like the idea, I'm happy to prepare a pull request. Please let me know. #