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/05/04 00:43:17 UTC

[jira] Created: (STDCXX-176) std::string::find() inefficient

std::string::find() inefficient
-------------------------------

         Key: STDCXX-176
         URL: http://issues.apache.org/jira/browse/STDCXX-176
     Project: C++ Standard Library
        Type: Improvement

  Components: 21. Strings  
    Versions: 4.1.3    
 Environment: all
    Reporter: Martin Sebor
 Assigned to: Martin Sebor 
    Priority: Critical
     Fix For: 4.1.4


The naive implementation of std::basic_string::find() in string.cc is quite inefficient:

    for (size_type __xpos = __pos; __xpos + __n <= size (); ++__xpos) {
        if (!traits_type::compare (_C_data + __xpos, __s, __n))
            return __xpos;
    }

    return npos;

See http://svn.apache.org/viewcvs.cgi/incubator/stdcxx/branches/4.1.3/include/string.cc?rev=366577&view=markup

-- 
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-176) std::string::find() inefficient

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

    Resolution: Fixed

Fixed with the referenced change.

> std::string::find() inefficient
> -------------------------------
>
>          Key: STDCXX-176
>          URL: http://issues.apache.org/jira/browse/STDCXX-176
>      Project: C++ Standard Library
>         Type: Improvement

>   Components: 21. Strings
>     Versions: 4.1.3
>  Environment: all
>     Reporter: Martin Sebor
>     Assignee: Martin Sebor
>     Priority: Critical
>      Fix For: 4.1.4

>
> The naive implementation of std::basic_string::find() in string.cc is quite inefficient:
>     for (size_type __xpos = __pos; __xpos + __n <= size (); ++__xpos) {
>         if (!traits_type::compare (_C_data + __xpos, __s, __n))
>             return __xpos;
>     }
>     return npos;
> See http://svn.apache.org/viewcvs.cgi/incubator/stdcxx/branches/4.1.3/include/string.cc?rev=366577&view=markup

-- 
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