1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Catching Debug Assert Failure

Discussion in 'Win32' started by Rajesh1978, Jun 25, 2010.

  1. Rajesh1978

    Rajesh1978 New Member

    Joined:
    Jun 25, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Sometimes I see the exception like "Debug Assertion Failed" from Microsoft C++ Debug Library

    See the following code.

    Code:
    
    int main()
    {
       map<int,double>m;
       m[1] = 123;
       m[34]= 321;
       map<int,double>::iterator itr;
       itr=m.find(100);
       //if(itr != m.end())   // I have commented this line of code
       cout<<itr->second<<endl;
      return 0;
    }
    
    Then I get a runtime exception like as I mentioned above.
    I know this can be removed If I uncomment the if statement

    Even with the commented if condition if I use the try catch block then alos I am not able to catch the exception.

    My question is how to catch this type of exception.
     

Share This Page