We can extract the duplicated behavior out into its own member function
and then reuse it in order to deduplicate repeated behavior.
This allows simplifying the member functions in a manner that allows
declaring most of the variables const. The lack of mutable behavior
within these functions makes it much nicer to read.
Makes use of the C++14 make_unique allocation function to allocate class
instances where applicable instead of a reset with a new operator within
it.
This doesn't touch cases where buffers are allocated, given make_unique
would zero-initialize them.