However, I can't figure out how to do it. It seems like it should be unambiguous because only the shared pointer has the -> operator, and only the weak pointer has the lock() function, but I can't get it to work.
When I try this it says there is a multiple definition error.
template <class T> bool checkPtrActive(T sptr) { return sptr->Active(); } template <class T> bool checkPtrActive(T wptr) { auto sptr = wptr.lock(); return sptr && sptr->Active(); }