$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] expected/result/etc
From: Peter Dimov (lists_at_[hidden])
Date: 2016-02-11 19:02:45
Gavin Lambert wrote:
> The only reason that shared_ptr::operator* does not throw is that the 
> class author decided that this is likely a hot path and the calling code 
> has *probably* already checked for null, so it is more *efficient* to omit 
> the check entirely (and cause undefined behavior if called in violation of 
> that assumption).
That's not true. The class author decided that calling operator* on a NULL 
pointer is a logic error and therefore a correct program should never do so. 
This doesn't have anything to do with performance; it's a question of 
design.