3 ms·
Copying into a string is a safe default. Also, proto’s API currently returns string references (and not views) so making a copy is required for open source. (A
by tylerhou 4y ago
Copying into a string is a safe default. Also, proto’s API currently returns string references (and not views) so making a copy is required for open source.
(Although now std::string_view is common, I hear rumors that the proto API might change…)
- secondcoming 4y agoI don't think it was about safety. It was because they didn't want to make ABSL part of the public API.
- tylerhou 4y agoMaybe that's true, but safety is an additional concern. You have way more lifetime headaches if you alias the underlying data. Copying avoids all that.