abseil / abseil/abseil-cpp

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

Open
#1,140 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
18.1k
Forks
3.2k
Avg merge
20h 36m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.