Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-176

std::string::find() inefficient

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 4.1.3
    • 4.1.4
    • 21. Strings
    • None
    • all

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              sebor Martin Sebor
              sebor Martin Sebor
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: