|
-
July 27th, 2011, 11:02 AM
#1
CArray debug exception
I'm running VS2010, 64-bit Win7. I created a new MFC-project, clicked finish to accept the wizard's default settings and inserted this code into the mainframe constructor:
Code:
#include <vector>
CMainFrame::CMainFrame()
{
CArray< std::vector<int>, std::vector<int>> arr;
std::vector<int> vec1;
vec1.push_back(1);
arr.Add( vec1 );
std::vector<int> vec2;
vec2.push_back(2);
arr.Add( vec2 );
std::vector<int> vec3;
vec3.push_back(3);
arr.SetAt( 0, vec3 );
std::vector<int> vecFirst = arr.GetAt(0);
CString output;
output.Format(_T("%d"), vecFirst.at(0));
AfxMessageBox(output);
// TODO: add member initialization code here
theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_VS_2008);
}
I expect to see a messagebox showing "3" when running the application. This works in release mode, but in debug mode throws "0xC0000005: Access violation".
Please, can someone explain why? Or is it just my computer?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|