CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Threaded View

  1. #9
    Join Date
    Aug 2006
    Posts
    231

    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
  •  





Click Here to Expand Forum to Full Width

Featured