Detailed introduction can see CSDN official introduction, link address http://msdn.microsoft.com/zh-cn/library/hh279678.aspx
Here are the examples in your app:
1 2#include <stdexcept>//Exception Handling Library3 4 //the inner parameter matrix MK is reversed and printed to show its inverse matrix5 Try //exception Handling in cases where k is a singular matrix irreversible6 {7 if(Invert (MK,MINVK,CV::D ecomp_lu))//matrix inversion, if the matrix is singular matrix, the condition is not established8 {9Std::cout << minvk << Std::endl;//Print display matrix dataTen } One Else //k is singular matrix A { - ThrowStd::invalid_argument ("error:intrinsic parameter K is singular."); - //Throw exception "K for singular matrix" the } - } - Catch(std::invalid_argument& e)//Get Exception condition - { +Std::cerr << e.what () << Std::endl;//Print Exception Alert - return-1; +}
C + + exception handling