Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Use string_view for non-owning string references

Aperta
#2,634 4 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
cpp

Direzione di ricerca

Inizia verificando gli utilizzi dell’API C++ pubblica di const std::string& per riferimenti non proprietari e tracciando dove tali valori passano nel livello rcl. Determina se l’API rcl può supportare input costituiti da stringa più lunghezza senza rompere i chiamanti. Il lavoro richiede un ambito concreto e concordato per l’adozione di string_view oppure una risoluzione documentata del blocco della terminazione null.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

backlog

Feature request

Currently, the API uses const std::string & for non-owning references to strings (e.g., topic names, node names). A more modern solution would be to use string_view. String constants can be declared as string_view in a header without initializing them in every translation unit. They are also constexpr, which can potentially open up some compile-time usage.

Feature description

The blocker for implementing this right now is that the rcl layer expects null-terminated strings. It's not possible to know if the byte following the string_view buffer is a null byte or simply uninitialized memory, so one would have to copy the data to a string anyway.

Right now, I don't see how this is viable without modifying the rcl API to accept string + length parameters. I thought I'd make the issue regardless, as from a pure C++ API standpoint, using string_views would perhaps be better.

Lingua principale
C++
Stelle
815
Fork
572
Merge medio
6g 8h
PR unite (30g)
20

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ros2/rclcpp

Tutte le issue di ros2/rclcpp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.