#include "stdafx.h" #include "thread_with_exceptions.h" #include namespace { struct my_exception : std::exception { const char* what() const { return "my exception"; } }; int return_something() { std::cout << "In return something" << std::endl; return 55; } int throw_my_exception() { std::cout << "In throw my exception" << std::endl; throw my_exception(); } } int main() { typedef boost::mpl::vector types; try { test::thread_with_exceptions t(throw_my_exception); const int rval = t.join(); std::cout << "Shouldn't see this: " << rval << std::endl; } catch (const my_exception& e) { std::cout << "Caught: " << e.what() << std::endl; } test::thread_with_exceptions t(return_something); const int rval = t.join(); std::cout << "should see this value: " << rval << std::endl; return 0; }