Behaves according to the specification of std::streambuf::overflow(), with the specialisation that std::length_error is thrown if appending the
character to the input sequence would require the condition size()>max_size() to be true.