Files
firestorm/Gameleap/code/mw4/Libraries/stuff/Initialized_Ptr.hpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

58 lines
880 B
C++

#pragma once
#ifndef PTR_HPP
#define PTR_HPP
#include "Stuff.hpp"
namespace Stuff
{
// Initialized_Ptr: An "initialized pointer" class (I wanted to call it just "Pointer"
// or "Ptr" but this caused some conflicts. This is just like a normal pointer,
// except that it must be explicitly constructed. This is very handy as it
// prevents uninitialized-pointer mishaps.
template <class T>
class Initialized_Ptr
{
public:
operator T*() const
{
return (m_ptr);
}
T& operator*() const
{
return (*m_ptr);
}
T* operator->() const
{
return (m_ptr);
}
Initialized_Ptr()
: m_ptr(0)
{
}
explicit Initialized_Ptr(T* ptr)
: m_ptr(ptr)
{
}
Initialized_Ptr& operator=(T* ptr)
{
m_ptr = ptr;
}
private:
T* m_ptr;
};
}; // namespace Stuff
#endif // PTR_HPP