nodejs / nodejs/node-addon-api

Support C++20 span types

オープン
#1,747 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

SemVer-major
主要言語
C++
スター
2.4k
フォーク
499
平均マージ
2日 11時間
マージ済み PR(30日)
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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、既存の Data() と長さアクセサの組み合わせを見つけ、次にポインター/長さの入力を受け取る New および Copy ファクトリを確認します。プロジェクトで C++ のバージョンガードと既存のオーバーロードをどのように扱っているかを確認します。ポインター/長さのオーバーロードを ABI 互換性のために維持したまま、両方向の std::span サポートを追加できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, nodejs
領域
backend-api-design
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。