Separate optional and variant support from other STL containers
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
I'd like to propose that we:
- move
std::optionalandstd::variantconversion support, which are currently inpybind11/stl.h, to a new file (saypybind11/utility.hsince they are in the STL utility library in C++17). - include
pybind11/utility.hfrompybind11/stl.hso 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. #
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pybind11/stl.h and locate the std::optional and std::variant conversion support. Move that support to the proposed pybind11/utility.h, include the new header from pybind11/stl.h for backward compatibility, and update the documentation Overview page to mention it. Done means the support is separated without breaking the existing header interface and the docs describe the new header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation, tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100