1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

vcmi: make ConstTransitivePtr always init self.

This commit is contained in:
Konstantin 2023-02-12 00:54:38 +03:00
parent c8c38ac922
commit b30d23d278

View File

@ -16,7 +16,7 @@ VCMI_LIB_NAMESPACE_BEGIN
template <typename T> template <typename T>
class ConstTransitivePtr class ConstTransitivePtr
{ {
T *ptr; T *ptr = nullptr;
ConstTransitivePtr(const T *Ptr) ConstTransitivePtr(const T *Ptr)
: ptr(const_cast<T*>(Ptr)) : ptr(const_cast<T*>(Ptr))
{} {}
@ -25,10 +25,7 @@ public:
: ptr(Ptr) : ptr(Ptr)
{} {}
ConstTransitivePtr(std::nullptr_t) ConstTransitivePtr(std::nullptr_t)
: ptr(nullptr)
{} {}
const T& operator*() const const T& operator*() const
{ {
return *ptr; return *ptr;