nodejs / nodejs/node-addon-api
Support C++20 span types
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.4k
- Forks
- 499
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 2
Description
node-addon-api's buffer-like types pass their backing memory as a raw pointer plus a separate length, both on the way out (Data() + a length accessor) and on the way in (the New/Copy factories). Callers must keep the two values in sync manually, with no bounds information attached to the pointer.
Once C++20 is the minimum supported standard, we should adopt std::span in both directions. These additions are ABI-compatible (existing pointer/length overloads stay), and give callers a single bounds-carrying handle that works with range-based for, <algorithm>, and <ranges>.
This can be an additive change with a C++ version guard.
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 locating the existing Data() and length accessor pair, then the New and Copy factories that accept pointer/length inputs. Review how the project handles C++ version guards and existing overloads. Done means additive std::span support in both directions, with the pointer/length overloads retained for ABI compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, nodejs
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100