You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2006/02/16 22:20:09 UTC

[jira] Created: (STDCXX-146) std::stringbuf(const string&) inefficient

std::stringbuf(const string&) inefficient
-----------------------------------------

         Key: STDCXX-146
         URL: http://issues.apache.org/jira/browse/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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (STDCXX-146) std::stringbuf(const string&) inefficient

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/STDCXX-146?page=all ]
     
Martin Sebor resolved STDCXX-146:
---------------------------------

    Resolution: Fixed

> std::stringbuf(const string&) inefficient
> -----------------------------------------
>
>          Key: STDCXX-146
>          URL: http://issues.apache.org/jira/browse/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
>     Assignee: 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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira