I'm using a library which export a function like:
// there is some type T
std::shared_ptr<T> foo(params);
and while the following code works fine:
auto p = foo(params);
auto & v0 = *p;
// use v0 as a T's reference
the below crashes:
auto & v1 = *foo(params);
// use v1 as a T's reference
So what is the difference between v0
and v1
? Many thanks for any help.