Ensure consistent override usage in TCachedToken

This commit is contained in:
Jack Andersen 2020-03-28 21:20:44 -10:00
parent eefb975f23
commit d1c2ae71c2
1 changed files with 3 additions and 3 deletions

View File

@ -137,13 +137,13 @@ public:
TCachedToken() = default;
TCachedToken(const CToken& other) : TToken<T>(other) {}
TCachedToken(CToken&& other) : TToken<T>(std::move(other)) {}
T* GetObj() {
T* GetObj() override {
if (!m_obj)
m_obj = TToken<T>::GetObj();
return m_obj;
}
const T* GetObj() const { return const_cast<TCachedToken<T>*>(this)->GetObj(); }
void Unlock() {
const T* GetObj() const override { return const_cast<TCachedToken<T>*>(this)->GetObj(); }
void Unlock() override {
TToken<T>::Unlock();
m_obj = nullptr;
}