|
-
July 27th, 2011, 05:10 PM
#9
Re: CArray debug exception
First, thanks to Philip for your reply.
1. The line "std::vector<int> vecFirst = arr.GetAt(0);" is causing the exception.
2. Agreed, sorry for not using const correctness in this example.
3. I already knew, I was just curious about the case I posted and looking for an explanation. It's dangerous since it's not detected during compile time, so quite easy to make such a mistake.
And thanks to Paul for pointing out the copy issue, but how/why does that differ in release mode where GetAt(0) appears to copy a valid vector?
So that means CArray is best avoided for non-POD types? I think many programmers are not aware of this.
As for the case with std::vector, like you said there is no reason to mix with CArray, this was just an example that puzzled me.
Last edited by TubularX; July 27th, 2011 at 05:12 PM.
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
|