Taken from: http://herbsutter.com/2013/05/22/gotw-5-solution-overriding-virtual-functions/
Why should we write:
auto pb = unique_ptr<base>{ make_unique<derived>() };
Instead of just:
auto pb = make_unique<derived>();
My only guess is that if we want auto
, we need to help it deduce the right type (base
here).
If so, then for me this would be really doubtful merit.. to type auto
and then type a lot of initialization on the right side of =
..
What am I missing?