abseil / abseil/abseil-cpp

Copying data out of Cord - CopyToArray/pread/memcpy like interface?

Aperta
#1,140 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
C++
Stelle
18.1k
Fork
3.2k
Merge medio
20h 36m
PR unite (30g)
1

Descrizione

Cord has CopyCordToString(). Could there be a helper function to copy to a char* buffer? For example,

```
// Copies the data in the cord from |offset| up to buffer |size|. Returns the actual number of bytes copied.
// Returns 0 if offset is out of bound.
size_t CopyToArray(char* buffer, size_t size, size_t offset = 0);
```

Alternatives considered: use cord.Subcord(offset, size) and iterate chunks, but Subcord() seems to have the overhead of creating new cord reps.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.