Skip to content
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

Separate optional and variant support from other STL containers #1207

Open
funchal opened this issue Dec 7, 2017 · 3 comments
Open

Separate optional and variant support from other STL containers #1207

funchal opened this issue Dec 7, 2017 · 3 comments

Comments

@funchal
Copy link

funchal commented Dec 7, 2017

I'd like to propose that we:

  • move std::optional and std::variant conversion support, which are currently in pybind11/stl.h, to a new file (say pybind11/utility.h since they are in the STL utility library in C++17).
  • include pybind11/utility.h from pybind11/stl.h so that we maintain full backward compatibility.
  • update the docs Overview page to mention the new header.

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. #

@funchal funchal changed the title Separate optional and variant support from other containers stl.h Separate optional and variant support from other STL containers Dec 7, 2017
@wjakob
Copy link
Member

wjakob commented Dec 7, 2017

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

@funchal
Copy link
Author

funchal commented Dec 8, 2017

Here you go: #1210

@funchal
Copy link
Author

funchal commented Jul 3, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants