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
move swap
reference
Union and possible undefined behavior
algorithm_1
Eight Queen
Structured Member Value Access Using Structure Member Pointer and Variadic Templates
Adaptive return type
fusion adapt 64 members v2
ambiguity does not count as ambiguity
cv4_template