pybind / pybind/pybind11_abseil
Error when converting absl::Span<const bool>
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 27
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
When trying to specify a py::arg with C++ type absl::Span (or more specifically in my case absl::optional<absl::Span>), I get an compile error:
./third_party/pybind11_abseil/absl_casters.h:378:12: error: no matching function for call to 'MakeSpan'
return absl::MakeSpan(static_cast<std::vector<value_type>&>(caster));
...
I guess this might be related to std::vector being potentially specialized as a bitset instead of an array of byte sized bools (https://github.com/abseil/abseil-cpp/issues/644). It would be nice to be able to define an py::arg as absl::Span though if it's possible to side-step this issue.
Contributor guide
No contributing guide indexed for this repository
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 third_party/pybind11_abseil/absl_casters.h around line 378 and reproduce the compile error for absl::Span, including the absl::optional case. Investigate the MakeSpan call and the interaction with std::vector; done means a py::arg using these types compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100