What happens in this case?
// assume WeakPtr is valid and has not expired
const auto& something = WeakPtr.lock();
something->doStuff();
Is this undefined?
Does it change in this scenario?
std::shared_ptr<Something> getSomething() { return mSomething.lock(); }
const auto& something = getSomething();
And how about this?
std::vector<int> getInts() { return std::vector<int>{ 1, 2, 3 }; }
const auto& ints = getInts();
In each of these cases const auto& implies that I want to bind a reference to the object, but in each of these cases I am binding it to a temporary rvalue object. Am I inviting disaster?