2022-04-10 00:17:06 +00:00
|
|
|
#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; }
|
2022-08-15 04:51:06 +00:00
|
|
|
T* get() const { return x0_ptr; }
|
|
|
|
// const T* get() const { return x0_ptr; }
|
2022-04-10 00:17:06 +00:00
|
|
|
T* operator->() { return x0_ptr; }
|
2022-08-14 18:38:41 +00:00
|
|
|
const T* operator->() const { return x0_ptr; }
|
2022-04-10 00:17:06 +00:00
|
|
|
void operator=(T* ptr) {
|
|
|
|
delete x0_ptr;
|
|
|
|
x0_ptr = ptr;
|
|
|
|
}
|
2022-08-13 01:26:00 +00:00
|
|
|
operator bool() const { return x0_ptr != nullptr; }
|
|
|
|
T& operator*() { return *x0_ptr; }
|
|
|
|
const T& operator*() const { return *x0_ptr; }
|
2022-04-10 00:17:06 +00:00
|
|
|
};
|
2022-08-13 01:26:00 +00:00
|
|
|
|
|
|
|
typedef single_ptr<void> unk_singleptr;
|
|
|
|
CHECK_SIZEOF(unk_singleptr, 0x4);
|
2022-04-10 00:17:06 +00:00
|
|
|
} // namespace rstl
|
|
|
|
|
|
|
|
#endif
|