Kylin/DataStructure/Pointer.h
2023-12-27 10:29:16 +08:00

39 lines
561 B
C++

#ifndef POINTER_H
#define POINTER_H
#include "Object.h"
namespace Kylin {
template<typename T>
class Pointer : public Object{
public:
T* get() const{
return m_pointer;
}
T& operator *() const{
return *m_pointer;
}
T* operator ->() const{
return m_pointer;
}
bool isNull() const{
return (m_pointer==nullptr);
}
virtual ~Pointer() = 0;
protected:
T *m_pointer = nullptr;
};
template<typename T>
Pointer<T>::~Pointer()
{
}
}
#endif // POINTER_H