Very small fix to initialise allocated storage when creating a new buffer; otherwise you end up with junk in your buffer, and I've had variable success in clearing it up.
The larger fix is to track when buffer() allocates memory when creating a new buffer_t object, and to delete it properly on destruction. Obviously only an issue if you create/discard a lot of buffers, but still...
The destructor unfortunately prevents buffer_t from being used as part of a constexpr (among other things). What about a subtype or wrapper for buffers owning their memory instead?
Very small fix to initialise allocated storage when creating a new buffer; otherwise you end up with junk in your buffer, and I've had variable success in clearing it up.
The larger fix is to track when
buffer()
allocates memory when creating a newbuffer_t
object, and to delete it properly on destruction. Obviously only an issue if you create/discard a lot of buffers, but still...