I use std::stringstream
extensively to construct strings and error messages in my application. The stringstreams
are usually very short life automatic variables.
Will such usage cause heap reallocation for every variable? Should I switch from temporary to class-member stringstream
variable?
In latter case, how can I reserve stringstream
buffer? (Should I initialize it with a large enough string or is there a more elegant method?)