Boost logo

Boost :

From: Bjorn Reese (breese_at_[hidden])
Date: 2019-09-01 14:59:37


On 9/1/19 3:10 PM, Roberto Hinz via Boost wrote:

> outbuf can be used to binary data, but the basic_cstr_writer class
> in particular may not be suitable for that, since its finish() function
> aways writes a terminating zero, requiring an extra space in the
> destination string. Perhaps we could add another class template,
> `basic_bin_writer`, that would never write a terminating character.

I was thinking more broadly than basic_cstr_write which I happened to
quote. I may want my template classes to operate on the return type
of any writer in a consistent manner. This is possible if they adhere
to ContiguousRange and SizedRange as suggested.

> Anyway, the returned result contains a `ptr` member that points to
> the end of the string. In order to add begin()/data()/size() functions
> basic_cstr_writer would also need to store the initial position,
> which would increase its size a little bit. And that's the only reason

Assuming the buffer is contiguous, begin == end - size, so there would
be no need to store an extra pointer.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk