2017-05-30 23:49 GMT+02:00 Peter Dimov via Boost
Vicente J. Botet Escriba wrote:
Do you want that boost.shared_ptr checks if not null before access on
operator->?
Checking in shared_ptr::op-> is narrow, by the way, and I regret putting that in. Should have been wide. Now we have endless debates whether to drop the noexcept because LWG guideline. (A daft guideline if you ask me, but that's what happens when people don't understand what the words "undefined behavior" mean.)
Peter, could you clarify the above. We can see three code snippets:
To expand on that a bit:
T* operator->() const noexcept; Requires: get() != nullptr. Returns: get().
Narrow, a mistake.
You say, you do not like the above, right? You call this mistake *only* because of this LWG guideline?
T* operator->() const noexcept; Returns: get().
Wide, as it should have been.
You say, you like the above, right? But what does it mean? That it returns a `(T*)nullptr` ? This is the same as your value_if? Regards, &rzej;