abseil / abseil/abseil-cpp

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

Đang mở
#1,140 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
C++
Star
18.1k
Fork
3.2k
Merge trung bình
20 giờ 36 phút
Pull request đã merge (30 ngày)
1

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.