absl::CopyCordToString

Copies the contents of a src Cord into a *dst string.

Synopsis

Declared in <absl/strings/cord.h>

void
CopyCordToString(
    Cord const& src,
    std::string* dst);

Description

This function optimizes the case of reusing the destination string since it can reuse previously allocated capacity. However, this function does not guarantee that pointers previously returned by dst->data() remain valid even if *dst had enough capacity to hold src. If *dst is a new object, prefer to simply use the conversion operator to std::string.

Parameters

NameDescription
srcThe Cord whose contents are copied.
dstThe string that receives the copied contents.