prime/include/rstl/single_ptr.hpp
Luke Street eb6819f1fd Continue work on CActor::UpdateAnimation; lots of headers n stuff
Former-commit-id: 85284f76408b91c78134fb192c8d3ac5cc685f99
2022-08-14 14:38:41 -04:00

33 lines
742 B
C++

#ifndef _RSTL_SINGLE_PTR_HPP
#define _RSTL_SINGLE_PTR_HPP
#include "types.h"
namespace rstl {
template < typename T >
class single_ptr {
T* x0_ptr;
public:
single_ptr() : x0_ptr(nullptr) {}
single_ptr(T* ptr) : x0_ptr(ptr) {}
~single_ptr() { delete x0_ptr; }
T* get() { return x0_ptr; }
const T* get() const { return x0_ptr; }
T* operator->() { return x0_ptr; }
const T* operator->() const { return x0_ptr; }
void operator=(T* ptr) {
delete x0_ptr;
x0_ptr = ptr;
}
operator bool() const { return x0_ptr != nullptr; }
T& operator*() { return *x0_ptr; }
const T& operator*() const { return *x0_ptr; }
};
typedef single_ptr<void> unk_singleptr;
CHECK_SIZEOF(unk_singleptr, 0x4);
} // namespace rstl
#endif