GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::bad_exception(3) C++ Standard Libary std::bad_exception(3)

std::bad_exception - std::bad_exception


Defined in header <exception>
class bad_exception;


std::bad_exception is the type of the exception thrown by the C++ runtime in the
following situations:


* If std::exception_ptr stores a copy of the caught exception and if
the copy constructor of the exception object caught by (since C++11)
std::current_exception throws an exception, the captured exception
is an instance of std::bad_exception.
* If a dynamic exception specification is violated and
std::unexpected throws or rethrows an exception that still
violates the exception specification, but the exception (until C++17)
specification allows std::bad_exception, std::bad_exception is
thrown.


std-bad exception-inheritance.svg


Inheritance diagram

Member functions


constructor constructs the bad_exception object
(public member function)
operator= copies the object
(public member function)
what returns the explanatory string
[virtual] (virtual public member function)

Inherited from std::exception

Member functions


destructor destroys the exception object
[virtual] (virtual public member function of std::exception)
what returns an explanatory string
[virtual] (virtual public member function of std::exception)

// Run this code


#include <iostream>
#include <exception>
#include <stdexcept>


void my_unexp() { throw; }


void test() throw(std::bad_exception)
{
throw std::runtime_error("test");
}


int main()
{
std::set_unexpected(my_unexp);
try {
test();
} catch(const std::bad_exception& e)
{
std::cerr << "Caught " << e.what() << '\n';
}
}


Caught std::bad_exception

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.