3 ms·
Exception safety is hardly a "default behavior" of C++, considering such gems[1] as: // This is unsafe. sink( unique_ptr<widget>{new widget{}},
by yongjik 9y ago
Exception safety is hardly a "default behavior" of C++, considering such gems[1] as:
// This is unsafe.
sink( unique_ptr<widget>{new widget{}},
unique_ptr<gadget>{new gadget{}} );
// This is safe.
sink( make_unique<widget>(), make_unique<gadget>() );
[1] https://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/ https://herbsutter.com/2013/05/29/gotw-89-solution-smart-poi...