nodejs / nodejs/node-addon-api
Support C++20 span types
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 2.4k
- 派生
- 499
- 平均合并
- 2 天 11 小时
- 30 天内合并 PR
- 2
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位现有的 Data() 和长度访问器这一对接口,然后查找接受指针/长度输入的 New 和 Copy 工厂。检查项目如何处理 C++ 版本保护以及现有的重载。完成的标准是以增量方式在两个方向上支持 std::span,同时保留指针/长度重载以确保 ABI 兼容性。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- cpp, nodejs
- 领域
- backend-api-design
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100