Read-only bindings for C++ const classes
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Dear Developers,
I wonder if it will be possible update Pybind11 so it honor C++ const correctness? In my package i have lots of functions that return MyClass const & and our users mistakenly tries to alter such objects witch lead to undefined behavior. If such const objects could be bound in some kind 'read-only' mode it would be really helpful!
Thank you,
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 by reviewing pybind11's handling of functions that return C++ const references and how those objects are exposed to Python. Define the intended read-only behavior and identify the necessary tests; done means const-bound objects cannot be altered through the Python interface without changing existing mutable bindings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100