Hi Anton,
What kind of a build was this? Is the testing infrastructure needed to
exhibit the problem or you just used it for convenience in printing the
results?
- Liviu
Anton Pevtsov wrote:
> The basic_string::insert (iterator p, InputIterator first, InputIterator
> last) doesn't work correctly on Linux for string str when
> first = str.begin() + 1, last = str.begin() + 3.
>
> This code illustrates the problem:
>
> #include <rw_printf.h>
> #include <rw_char.h>
>
> #include <string>
> #include <cstddef>
>
> int main (void)
> {
> typedef std::basic_string <char, std::char_traits<char>,
> std::allocator<char> > TestString;
>
> char test[] = "abcdef";
> char exp_test[] = "bcabcdef";
>
> TestString s (test, 6);
> s.insert (s.begin (), s.begin () + 1, s.begin () + 3);
>
> rw_printf ("this (%{#*s})->insert (*this.begin (), "
> "*this.begin () + 1, *this.begin () + 3) "
> " == %{#*s}, got %{#*s}\n",
> 6, test, 8, exp_test, int (s.size ()), s.c_str ());
>
> return 0;
> }
>
>
> The output is
> this ("abcdef")->insert (*this.begin (), *this.begin () + 1, *this.begin
> () + 3) == "bcabcdef", got "baabcdef"
>
> On Windows the output is:
> this ("abcdef")->insert (*this.begin (), *this.begin () + 1, *this.begin
> () + 3) == "bcabcdef", got "bcabcdef"
>
> Martin, could you look into this when you have a chance, please?
>
> If you reproduce the problem I'll open the jira issue and try to
> investigate the cause.
>
>
> Thanks,
> Anton Pevtsov
>