stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Chariton <chari...@roguewave.com>
Subject RE: [jira] Resolved: (STDCXX-179) std::vector::insert(iterator, F orwardIterator, ForwardIterator) inserts wrong data
Date Wed, 24 May 2006 17:11:29 GMT
I tested the new patch.  Everything appears to be working properly now.

Thank you!

Craig Chariton

-----Original Message-----
From: Martin Sebor (JIRA) [mailto:jira@apache.org] 
Sent: Wednesday, May 24, 2006 8:52 AM
To: stdcxx-dev@incubator.apache.org
Subject: [jira] Resolved: (STDCXX-179) std::vector::insert(iterator,
ForwardIterator, ForwardIterator) inserts wrong data

     [ http://issues.apache.org/jira/browse/STDCXX-179?page=all ]
     
Martin Sebor resolved STDCXX-179:
---------------------------------

    Resolution: Fixed

The new patch should do it.

> std::vector::insert(iterator, ForwardIterator, ForwardIterator) inserts
wrong data
>
----------------------------------------------------------------------------
------
>
>          Key: STDCXX-179
>          URL: http://issues.apache.org/jira/browse/STDCXX-179
>      Project: C++ Standard Library
>         Type: Bug

>   Components: 23. Containers
>     Versions: 4.1.3
>  Environment: All.
>     Reporter: Craig Chariton
>     Assignee: Martin Sebor
>     Priority: Critical
>      Fix For: 4.1.4

>
> There is an interesting problem that occurs with vectors.  Here is the
sample code:
> #include <iostream>   // for cout, endl
> #include <vector>     // for vector
> int main ()
> {
>   std::vector<int> a;
>   a.push_back(1);
>   a.push_back(2);
>   a.push_back(3);
>   a.push_back(4);
>   std::vector<int> b;
>   b.push_back(0);
>   a.insert(a.begin(), b.begin(), b.end());
>   for( std::vector<int>::iterator i = a.begin(); i != a.end(); ++i)
>     std::cout << (*i) << ",";
>     std::cout << std::endl;
>    return 0;
> }
> The output is 0,2,3,1,2, instead of 0,1,2,3,4, .
> I tried some other combinations as follows:
> a = 1, b = 0  -  works, get 0,1
> a = 1,2, b = 0  -  works, get 0,1,2
> a = 1,2,3, b = 0  -  fails, get 0,2,1,2
> a = 1,2,3, b = 0, 5  -  fails, get 0,5,3,2,3
> a = 1,2, b = 0,5  -  works, get 0,5,1,2
> a = 1,2,3,4, b = 0,5  -  works, get 0,5,1,2,3,4
> a = 1,2,3,4,5, b = 0,5  -  fails, get 0,5,3,1,2,3,5

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

Mime
View raw message