exception - STL C++

terminate_handler

Declaration

typedef void (*terminate_handler)();

Description

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

Header Include

#include <exception>

Example

#include <iostream>
#include <exception>

void NewTerminate() {
	std::cout << "The end." << std::endl;
	abort();
}

int main() {
	// Set a new terminate handler and get the old one back
	terminate_handler qOldTerminate = set_terminate(NewTerminate);

	// Call terminate directly
	terminate();

	return 0;
}

Output

terminate_handler Output
 

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