Simplified copy-on-write implementation of ByteVector

Simplified the copy-on-write implementation of ByteVector by replacing a nested private class with a smart pointer.