473,396 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

CArray Setsize

class deque2
int m_iIndex; // record number
int m_iOffset; // number of record to insert/delete


class deque1
std::deque<deque2> m_undoBuff;
std::deque<deque2>::iterator m_undoPtr;

m_undoPtr = m_undoBuff.begin();

m_undoPtr = m_undoBuff.begin();


void CkkkDlg::OnBnClickedOk()

CArray<deque1,deque1&> carray1;

carray1[0].m_undoPtr=carray1[0].m_undoBuff.begin(); -> (1)

carray1[0].m_undoPtr=carray1[0].m_undoBuff.begin();-> (2)


this code is running fine at (1) where as it is giving error at (2)
Thanks in advance, please tell me the error in the code
Dec 6 '07 #1
2 4245
9,208 Expert Mod 8TB
Is CArray running your deque1 constructors ??

I mean, were this a vector, the array is empty so subscript 0 is invalid until you put an object in the container.

BTW: Why CArray and not vector<> ???
Dec 6 '07 #2
Is CArray running your deque1 constructors ??

I mean, were this a vector, the array is empty so subscript 0 is invalid until you put an object in the container.

BTW: Why CArray and not vector<> ???
This code is building fine in VC++2003 where as it is giving runtime error
"Unhandled exception at 0x00413ff0 in kkk.exe: 0xC0000005: Access violation reading location 0xfeeefef2."

Call Stack
> kkk.exe!std::_Iterator_base::_Orphan_me() Line 174 + 0x3 bytes C++
kkk.exe!std::_Iterator_base::operator=(const std::_Iterator_base & _Right={...}) Line 142 C++
kkk.exe!std::_Ranit<deque2,int,deque2 const *,deque2 const &>::operator=(const std::_Ranit<deque2,int,deque2 const *,deque2 const &> & __that={...}) + 0x2f bytes C++
kkk.exe!std::_Deque_const_iterator<deque2,std::all ocator<deque2>,1>::operator=(const std::_Deque_const_iterator<deque2,std::allocator<d eque2>,1> & __that=deque[0] = {m_iIndex=1 m_iOffset=2 }) + 0x2f bytes C++
kkk.exe!std::_Deque_iterator<deque2,std::allocator <deque2>,1>::operator=(const std::_Deque_iterator<deque2,std::allocator<deque2> ,1> & __that=deque[0] = {m_iIndex=1 m_iOffset=2 }) + 0x2f bytes C++
kkk.exe!CkkkDlg::OnBnClickedOk() Line 197 + 0x49 bytes C++
mfc80d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x0012fe2c, unsigned int nID=1, int nCode=0, void (void)* pfn=0x004118c0, void * pExtra=0x00000000, unsigned int nSig=56, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 82 C++
mfc80d.dll!CCmdTarget::OnCmdMsg(unsigned int nID=1, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 381 + 0x27 bytes C++
mfc80d.dll!CDialog::OnCmdMsg(unsigned int nID=1, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 85 + 0x18 bytes C++
mfc80d.dll!CWnd::OnCommand(unsigned int wParam=1, long lParam=69116) Line 2300 C++
mfc80d.dll!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=1, long lParam=69116, long * pResult=0x0012f7f4) Line 1755 + 0x1e bytes C++
mfc80d.dll!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=1, long lParam=69116) Line 1741 + 0x20 bytes C++
mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0012fe2c, HWND__ * hWnd=0x00010df8, unsigned int nMsg=273, unsigned int wParam=1, long lParam=69116) Line 240 + 0x1c bytes C++
mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x00010df8, unsigned int nMsg=273, unsigned int wParam=1, long lParam=69116) Line 389 C++
Dec 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Ishira | last post by:
Here is a snippet of my program. It is really intresting... PREMISE: Class CobjA has a private CARRAY memeber m_Arr of objects CobjB. Class CobjB is a class with an int data variable called...
by: Ishira | last post by:
Hello, Please help. I am seriously at my wits end. Just when I feel I have completely understood copy contructor, I am stumped yet again. I have a class which has a CARRAY of objects. I am...
by: Mike Stenzler | last post by:
I am new to Template programming and I would like to create an array of user-defined class objects using MFC CArray. Normally I would use linked list processing - create an object class and then an...
by: Frank King | last post by:
Hi, I am using CArray and quick sort funciton to sort an array of double type of data points. I found an article in MSDN HOWTO: Quick Sorting Using MFC CArray-Derived Classes ID: Q216858 ...
by: Silly | last post by:
I have a legacy dll that has an important function that takes a CArray<WORD,WORD>& as it's only parameter. The dll is used by a number of internal applications and so can't be changed. I am...
by: db01092001 | last post by:
Hello, I'm interested in the internal organization of CArray, especially the execution time for the members, the operator respective: Determines the use of in constant time (O(1))? What about...
by: Josh McFarlane | last post by:
I'm currently reading raw data files for two arrays of floating point numbers. There are about 10k floating points per array per file, and I want to combine each file's arrays into a master...
by: fei.liu | last post by:
Consider the following sample code char * ptr = "hello"; char carray = "hello"; int main(void){ } What does the standard have to say about the storage requirement about ptr and carray? Is...
by: Dymus | last post by:
Ok here is sample of code: CArray <MyClass,MyClassarr; MyClass * obj; obj = new MyClass(); obj->some_field=some_value; arr.Add((*obj)); delete obj; ----
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.