[orbis-kernel] rc: add cast utilities

This commit is contained in:
DH 2023-11-11 16:22:08 +03:00
parent 8e376c465e
commit 60c3077cd6

View File

@ -124,6 +124,13 @@ public:
bool operator==(std::nullptr_t) const { return m_ref == nullptr; }
auto operator<=>(const T *other) const { return m_ref <=> other; }
auto operator<=>(const Ref &other) const = default;
template <typename OtherT> Ref<OtherT> cast() {
return Ref<OtherT>(dynamic_cast<OtherT *>(m_ref));
}
template <typename OtherT> Ref<OtherT> staticCast() {
return Ref<OtherT>(static_cast<OtherT *>(m_ref));
}
};
// template <WithRc T, typename... ArgsT>