Is the size allotted based on amount of dynamically allotted memory available? what happens when we reach this limit is there an exception thrown or it overwrites to some other
The buffer of a std::stringstream
object is a wrapper around a std::string
object. As such, the maximum size is std::string::max_size()
. When the stream cannot allocate further, an exception will be thrown by the buffer which is probagated to the stream. The response is to turn on std::ios_base::badit
in its stream state. Attempting to write pass this point will do nothing unless the stream state is cleared and the buffer is at least partially emptied.