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

std::string::replace (iterator, iterator, InputIterator, InputIterator) inserting self incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 4.1.3, 4.1.4, 4.2.0
    • 4.3.0
    • 21. Strings
    • None
    • all

    Description

      This test fails:

      #include <iostream>
      #include <string>

      static const char* test = "babc";

      int main (void)
      {
      std::string s ("abc");
      s.replace (s.begin (), s.begin (), s.begin () + 1, s.begin () + 2);

      std::cout << "Expected " << test << " and got " << s << '\n';

      return 0;
      }

      The output is "Expected babc and got aabc".

      See details here:
      http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200604.mbox/%3c44337C76.4020909@roguewave.com%3e

      Attachments

        1. 21.string.replace.stdcxx-170.cpp
          2 kB
          Farid Zaripov
        2. string.cc.diff
          9 kB
          Farid Zaripov
        3. stdcxx-170.patch
          2 kB
          Travis Vitek

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pevtsov Anton Pevtsov
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 8h Original Estimate - 8h
                  8h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 18h
                  18h