On 10/03/2020 09:56, Janson R. wrote:
Observation is mostly correct, and it is one of the main reasons I've come to ask for feedback here; Vinnie rightfully pointed out that the question being asked is "what [does] a clean, Boost-quality, modern C++ API to codec that operates on memory buffers [look] like[?]".
That answer may be different depending on your context; for example Boost.Asio provides a number of buffer concepts and methods for manipulating them. Which are good, in that they're templates and support all kinds of different buffer concepts (from basic vectors and strings through to dynamic multi-buffer streams), and you only pay for the complexity that you actually use. They're also bad, in that they're templates and they're harder to consume generically without forcing your own code to also be a template. But if you're in the context of Boost.Beast or some other app that uses Asio, it makes sense to use these buffer concepts rather than reinventing the wheel, especially with these things probably-maybe-eventually landing in the standard. Forthcoming std::span might be another interesting candidate.
Since the emails discussions have begun I've integrated the following prototype API after suggestion by a few of the people here: ``` optionalstd::string easy_compress(string_view in, wrap wrapping = wrap::none);
optionalstd::string easy_uncompress(string_view in, wrap wrapping = wrap::none); ``` While it works (and I do sometimes use it myself if I'm especially lazy) I dislike use of std::string and friends for arbitrary binary data.
std::basic_string