std::set_terminate (3) - Linux Manuals
std::set_terminate: std::set_terminate
Command to display std::set_terminate
manual in Linux: $ man 3 std::set_terminate
NAME
std::set_terminate - std::set_terminate
Synopsis
Defined in header <exception>
std::terminate_handler set_terminate( std::terminate_handler f ) throw(); (until C++11)
std::terminate_handler set_terminate( std::terminate_handler f ) noexcept; (since C++11)
Makes f the new global terminate handler function and returns the previously installed std::terminate_handler.
This function is thread-safe. Every call to std::set_terminate synchronizes-with (see std::memory_order) the subsequent std::set_terminate and std::get_terminate (since C++11)
Parameters
f - pointer to function of type std::terminate_handler, or null pointer
Return value
The previously-installed terminate handler, or a null pointer value if none was installed.
Example
// Run this code
#include <iostream>
#include <cstdlib>
#include <exception>
int main()
{
std::set_terminate([](){ std::cout << "Unhandled exception\n"; std::abort();});
throw 1;
}
Possible output:
Unhandled exception
bash: line 7: 7743 Aborted (core dumped) ./a.out
See also
function called when exception handling fails
terminate (function)
get_terminate obtains the current terminate_handler
(function)
(C++11)
the type of the function called by std::terminate
terminate_handler (typedef)
Pages related to std::set_terminate
- std::set_difference (3) - std::set_difference
- std::set_intersection (3) - std::set_intersection
- std::set_new_handler (3) - std::set_new_handler
- std::set_symmetric_difference (3) - std::set_symmetric_difference
- std::set_unexpected (3) - std::set_unexpected
- std::set_union (3) - std::set_union
- std::set (3) - std::set
- std::set<Key,Compare,Allocator>::begin,std::set<Key,Compare,Allocator>::cbegin (3) - std::set<Key,Compare,Allocator>::begin,std::set<Key,Compare,Allocator>::cbegin
- std::set<Key,Compare,Allocator>::clear (3) - std::set<Key,Compare,Allocator>::clear
- std::set<Key,Compare,Allocator>::contains (3) - std::set<Key,Compare,Allocator>::contains
- std::set<Key,Compare,Allocator>::count (3) - std::set<Key,Compare,Allocator>::count
- std::set<Key,Compare,Allocator>::emplace (3) - std::set<Key,Compare,Allocator>::emplace