After JAVA I had to tackle C ++. The simplest example, but it doesn’t work for me:
#include <iostream>
void handle_exceptions(std::exception_ptr e);
   std::exception_ptr e;   
int main()
{
    try {
        throw new std::exception("test");
    }
    catch (...) {
        e = std::current_exception();
        handle_exceptions(e);
    }
} // END: main
void handle_exceptions(std::exception_ptr e)
{
    try {
        if (e) { std::rethrow_exception(e); }
    }
    catch (const std::exception & e) {
        std::cerr << std::endl << e.what();
        std::exit(0);
    }
} // END: handle_exception()
The line of std::rethrow generates an unhandled exception: Возникло необработанное исключение по адресу 0x766A08B2 в ConsoleApplication1.exe: исключение Microsoft C++: std::exception по адресу памяти 0x00BAF1F0.
Possible std::exception_ptr is not NULL. Wrong memory access, but why?
 
    