Missing API to interact with the underlying pointer types
mingxwa opened this issue · comments
Sometimes it is useful to invoke a dispatch on the underlying pointer types without dereferencing them. For example, when refactoring the following code with proxy
:
struct IMyAbstraction { ...; };
std::shared_ptr<IMyAbstraction> p = ...;
std::weak_ptr<IMyAbstraction> weak{p};
...
auto locked = weak.lock();
if (static_cast<bool>(locked)) {
...
}
It is currently infeasible to create a std::weak_ptr
from a proxy
, even if the underlying pointer is std::shared_ptr
, because there is currently no API to touch the underlying pointer via a proxy
.