-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Separate optional and variant support from other STL containers (#1207) #1210
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
base: master
Are you sure you want to change the base?
Conversation
This rename sounds good to me in principle, but I have one concern: Thoughts (to you and @wjakob and anyone else who wants to offer an opinion on the matter) on going a bit bigger on this reorganization by putting this into We already added the |
@jagerman Thanks for having a look at this. I thought about your comment for a bit, and here's my opinion for what it's worth:
|
The main reason is, I believe, just to keep the compilation a bit faster but not pulling in extra headers needed for stl containers in cases where they aren't needed. Including doesn't exactly change the behaviour: without it, trying to return a stl container just results in a failure because pybind won't know how the cast the type to Python (because it'll get to the generic type caster, but
I agree with you that
Agreed. That's basically why we moved things into |
Adding this to finally be resolved in 2.7.0 :-) Maybe through a new, non-conflicting PR, though. |
Move
std::optional
andstd::variant
conversion support, which were previously inpybind11/stl.h
, to a new header filepybind11/utility.h
since they are in the STL utility library in C++17. Includepybind11/utility.h
frompybind11/stl.h
so that we maintain full backward compatibility. Update the docs, tests and changelog to mention the new header.