Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
throwing an exception containing a unique_ptr is dangerous
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> #include <future> class danger : public std::runtime_error { using runtime_error::runtime_error; std::unique_ptr<int> state_ = std::make_unique<int>(); }; int main() { auto f = std::async([]() { throw danger("hello"); }); try { f.get(); } catch (...) { std::cout << "Double-delete incoming!" << std::endl; } }
run
|
edit
|
history
|
help
0
binary
wrong up
Increment pointer to struct
MSVC ignoring unknown attributes
c++ pure apstraction
Buggy Strcat
Wide string to lowercase
boost::asyc fail with error C2280: attempting to reference a deleted function
parantheses matching test 1
Initializing member array of structs