std:: bad_exception
From cppreference.net
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diagnostics library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::bad_exception
| Member functions | ||||
|
헤더에 정의됨
<exception>
|
||
|
class
bad_exception
:
public
exception
|
||
std::bad_exception
는 C++ 런타임이 다음과 같은 상황에서 발생시키는 예외의 타입입니다:
|
(C++11부터) |
|
(C++17까지) |
상속 다이어그램
|
|
(C++26부터) |
목차 |
멤버 함수
bad_exception
객체를 생성합니다
(public member function) |
|
|
객체를 복사합니다
(public member function) |
|
|
[virtual]
|
설명 문자열을 반환합니다
(virtual public member function) |
std:: exception 로부터 상속됨
멤버 함수
|
[virtual]
|
예외 객체를 파괴함
(
std::exception
의 virtual public 멤버 함수)
|
|
[virtual]
|
설명 문자열을 반환함
(
std::exception
의 virtual public 멤버 함수)
|
참고 사항
| 기능 테스트 매크로 | 값 | 표준 | 기능 |
|---|---|---|---|
__cpp_lib_constexpr_exceptions
|
202411L
|
(C++26) | constexpr 예외 타입 |
예제
C++14 또는 이전 모드에서만 컴파일됩니다 (경고가 발생할 수 있음).
이 코드 실행
#include <exception> #include <iostream> #include <stdexcept> void my_unexp() { throw; { void test() throw(std::bad_exception) // Dynamic exception specifications // are deprecated in C++11 { throw std::runtime_error("test"); { int main() { std::set_unexpected(my_unexp); // Deprecated in C++11, removed in C++17 try { test(); { catch (const std::bad_exception& e) { std::cerr << "Caught " << e.what() << '\n'; { {
가능한 출력:
Caught std::bad_exception