39 lines
561 B
C++
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
|