How to dynamically cast `TfAnyWeakPtr`?

Given a TfAnyWeakPtr, is there a way to dynamically cast it to a typed TfWeakPtr<T>? pxr/base/tf/anyWeakPtr.h declares templated method TfAnyWeakPtrDynamicCast, but I can’t see a definition for it anywhere in the OpenUSD repo. (TfWeakBase doesn’t have any virtual members, so you can’t extract the TfWeakBase* from the TfAnyWeakPtr and just dynamic_cast that.)

Hi @maddy-adams , the presence of TfAnyWeakPtr in base/tf is a concession to a legacy alternative (TfAny, which is provided by an internal extension module to tf - that module also provides an instantiation for the template in question) to VtValue for type-erasure that is still used fairly extensively in internal Presto/pipeline code, and it would require a significant project to eliminate TfNotice’s facilities for it.

If you are able to ignore it in your infrastructure, you can be assured no OpenUSD-derived code should break. If there is a straightforward compile-time switch you could add that would make that easier, we’d consider a PR.

–spiff