I have a std::unique_ptr
and another raw pointer. I want the raw pointer to point to the content of the unique_ptr
without any kind of ownership. It is read-only relationship:
auto bar=std::make_unique<foo>();
auto ptr=bar.get();// This may point to another value later
Is this bad? Is there any alternative?
Note: the real example is more complex. They are not in the same class.