stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <>
Subject [jira] Created: (STDCXX-146) std::stringbuf(const string&) inefficient
Date Thu, 16 Feb 2006 21:20:09 GMT
std::stringbuf(const string&) inefficient

         Key: STDCXX-146
     Project: C++ Standard Library
        Type: Sub-task
  Components: 27. Input/Output  
    Versions: 4.1.2, 4.1.3    
 Environment: all
    Reporter: Martin Sebor
 Assigned to: Martin Sebor 
     Fix For: 4.1.4

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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message