The semantics are:
- If you default-construct a shared pointer, or construct one from
nullptr_t
, it's empty; that is, it doesn't own any pointer. - If you construct one from a raw pointer, it takes ownership of that pointer, whether or not it's null. I guess that's done for the reason you mention (avoiding a runtime check), but I can only speculate about that.
So your example isn't empty; it owns a null pointer.