shared_ptr::operator-> does not fail for nullptr
Jonathan Wakely
jwakely.gcc@gmail.com
Wed Jun 11 22:36:00 GMT 2014
On 11 June 2014 16:16, Christoph Mathys wrote:
> Now, is this the expected behaviour of shared_ptr? Do I need to check
> myself that my smart_ptr is non-nil similar to "manual" bounds
> checking when using operator[] on std::vector?
Yes, but a much better analogy than std::vector is using a normal
pointer. Don't dereference it unless you know it's non-null.
More information about the Gcc-help
mailing list