The member functions getting the underlying character sequence
all refer to a high_mark value,
where high_mark represents the position
one past the highest initialized character in the buffer.
Characters can be initialized by writing to the stream,
by constructing the basic_stringbuf
passing a basic_string argument, or
by calling one of the str member functions
passing a basic_string as an argument.
In the latter case, all characters initialized prior to the call
are now considered uninitialized
(except for those characters re-initialized by the new basic_string).
For efficiency reasons,
stream buffer operations can violate invariants of buf
while it is held encapsulated in the basic_stringbuf,
e.g., by writing to characters in the range
[buf.data()+ buf.size(), buf.data()+ buf.capacity()).
All operations retrieving a basic_string from buf
ensure that the basic_string invariants hold on the returned value.