Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Noexcept
#include <iostream> #include <string> #include <memory> #include <functional> #include <exception> struct Thrower { Thrower() { std::cout << "throwing..." << std::endl; throw 42; } }; struct AsMember { Thrower t_; AsMember() noexcept : t_{} { std::cout << "ctor" << std::endl; } }; struct AsBase : Thrower { AsBase() noexcept { std::cout << "ctor" << std::endl; } }; struct AsNSDMI { Thrower t_ {}; AsNSDMI() noexcept { std::cout << "ctor" << std::endl; } }; int main() { std::set_terminate([](){ std::cout << "terminating..." << std::endl; }); try { AsMember a1{}; AsBase a2{}; AsNSDMI a3{}; } catch (...) { //... std::cout << "caught..." << std::endl; } return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
VS2013 hello world includes
MSVC14 <exception> header
Copy elision sample modern C++
RVO hota hai bhenchod
copy
why fatal error C1083
hangman
inherited
error_code example
Static cast of Enum
Please log in to post a comment.