exception - STL C++

unexpected_handler

Declaration

typedef void (*unexpected_handler)();

Description

This is the type definition of the unexpected_handler type in the exception header.

Header Include

#include <exception>

Example

#include <iostream>
#include <exception>

void NewUnexpected() {
	std::cout << "Unexpected exception handler!" << std::endl;
	terminate();
}

int main() {
	// Set a new unexpected handler and get the old one back
	unexpected_handler qOldUnexpected = set_unexpected(NewUnexpected);

	// Call the unexpected function directly
	unexpected();

	return 0;
}

Output

unexpected_handler Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.