Have BufferOutput respect buffer size
thesmartwon opened this issue · 1 comments
thesmartwon commented
I'm having trouble making a long lived BufferOutput
since its constructor requires a pointer to a Buffer
. It feels wrong to allocate Buffer
on the heap for a stable pointer since it's just a std::vector
that already allocates its storage on the heap.
An easy fix is this patch to BufferOutput
:
BufferOutput::BufferOutput(Buffer* buf)
: buf_(buf)
- , pos_(0)
+ , pos_(buf->size())
Is there any reason not to do this?
Enmk commented
Hi @thesmartwon could you please elaborate on what you are trying to achieve? Also, if you see any obvious hickups or bugs in the code, please feel free to submit a PR