mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
50 lines
608 B
C++
50 lines
608 B
C++
#pragma once
|
|
|
|
template <typename T>
|
|
class ConstTransitivePtr
|
|
{
|
|
T *ptr;
|
|
public:
|
|
ConstTransitivePtr(T *Ptr = NULL)
|
|
: ptr(Ptr)
|
|
{}
|
|
|
|
const T& operator*() const
|
|
{
|
|
return *ptr;
|
|
}
|
|
T& operator*()
|
|
{
|
|
return *ptr;
|
|
}
|
|
operator const T*() const
|
|
{
|
|
return ptr;
|
|
}
|
|
T* get()
|
|
{
|
|
return ptr;
|
|
}
|
|
const T* get() const
|
|
{
|
|
return ptr;
|
|
}
|
|
operator T*()
|
|
{
|
|
return ptr;
|
|
}
|
|
T *operator->()
|
|
{
|
|
return ptr;
|
|
}
|
|
const T *operator->() const
|
|
{
|
|
return ptr;
|
|
}
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
{
|
|
h & ptr;
|
|
}
|
|
};
|