nodejs / nodejs/node-addon-api
Support C++20 span types
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 2.4k
- Forks
- 499
- Ø Merge
- 2 T. 11 Std.
- Gemergte PRs (30 T.)
- 2
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das vorhandene Paar aus Data() und dem Längen-Accessor zu finden, danach die New- und Copy-Factories, die Pointer-/Längen-Eingaben akzeptieren. Überprüfe, wie das Projekt C++-Versionsprüfungen und vorhandene Overloads handhabt. Als abgeschlossen gilt die additive std::span-Unterstützung in beide Richtungen, wobei die Pointer-/Längen-Overloads aus Gründen der ABI-Kompatibilität erhalten bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, nodejs
- Bereich
- backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100