Talk:cpp/error/set terminate
From cppreference.com
An example of usage of set_terminate() would be useful here.
83.114.154.3 03:03, 19 July 2014 (PDT)
Agreed, a simple example would be useful!
for example
#include <iostream>
#include <exception>
#include <cstdlib>
int main()
{
// abort() - abnormal termination
std::set_terminate([](){ std::cout << "Unhandled exception\n"; std::abort();});
throw 1;
}
Output:
Unhandled exception Aborted (core dumped) // on Linux
31.223.129.253 17:42, 19 January 2016 (PST)Lanmi