Search

STL Vector of Vector Insertion Problem by ozgurcolpankan

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 735732
Opened: 4/5/2012 11:30:45 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
The code is working normally on Visual Studio 2005. However, in visual studio 2010 with new rvalue reference feature vector class has been upgraded. So in this code it is throwing exception.

#include <vector>
#include <iostream>

using namespace std;

int main()
{
    vector<vector<int>> testVec;
    vector<int> vec;
    
    //if this is included code is working successfully, otherwise throws exception.
    //testVec.reserve(2);

    testVec.push_back(vec);
    testVec.insert(testVec.end(), testVec.at(0)); //exception is throwed here

    return 0;
}
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010 SP1

Steps to reproduce

#include <vector>
#include <iostream>

using namespace std;

int main()
{
    vector<vector<int>> testVec;
    vector<int> vec;
    
    //if this is included code is working successfully, otherwise throws exception.
    //testVec.reserve(2);

    testVec.push_back(vec);
    testVec.insert(testVec.end(), testVec.at(0)); //exception is throwed here

    return 0;
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Throwing exception at insertion.

Expected results

Inserting vector element successfully.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 4/9/2012 at 12:46 PM
Hi,

Thanks for reporting this bug. We've already fixed it, and you can observe the fix in the VC11 Beta.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by MS-Moderator09 [Feedback Moderator] on 4/6/2012 at 2:26 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 4/5/2012 at 11:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.