runtime_error Class

클래스에만 프로그램을 실행 하면 아마도 검색 보고서 오류가 throw 된 모든 예외에 대 한 기본 클래스 역할을 합니다.

class runtime_error : public exception {
public:
    explicit runtime_error(const string& message);
    explicit runtime_error(const char *message);
};

설명

반환 값 exception Class 의 복사본 인 메시지.데이터.

예제

// runtime_error.cpp
// compile with: /EHsc /GR
#include <iostream>

using namespace std;

int main( )
{
// runtime_error
   try 
   {
      locale loc( "test" );
   }
   catch ( exception &e ) 
   {
      cerr << "Caught " << e.what( ) << endl;
      cerr << "Type " << typeid( e ).name( ) << endl;
   };
}
  

요구 사항

헤더: <stdexcept>

네임 스페이스: std

참고 항목

참조

exception Class

표준 C++ 라이브러리에서 스레드로부터의 안전성