If each dereferenced shared pointer had to check for nullptr and conditionally throw an exception, there could be a lot of redundant checks, code bloating and overhead. Of course, the optimizer will probably eliminate some of them, but still ... Instead, the programmer had to check once before doing this - many dereferences.
Tony delroy
source share