Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.1.2, 4.1.3
-
None
-
all
Description
The basic_stringbuf(const basic_string&) ctor is an inefficient interface when constructing a stringbuf object from a character array (as opposed to an already existing string object). Each invocation of the ctor causes a temporary string object to be allocated for the formal function argument only to have it deallocated as soon as the stringbuf ctor returns.
A basic_stringbuf(const char_type*) ctor overload would be a much more efficient interface.
The same goes for the str(const basic_string&) member function of basic_stringbuf as well as for all the stringstream class templates.