mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-23 17:09:44 +00:00
ec9729a9e1
byuu says: Changelog: - nall: renamed array to adaptive_array; marked it as deprecated - nall: created new array class; which is properly static (ala std::array) with optional bounds-checking - sfc/ppu-fast: converted unmanaged arrays to use nall/array (no speed penalty) - bsnes: rewrote the cheat code editor to a new design - nall: string class can stringify pointer types directly now, so pointer() was removed - nall: added array_view and pointer types (still unsure if/how I'll use pointer)
35 lines
865 B
C++
35 lines
865 B
C++
#pragma once
|
|
|
|
namespace nall {
|
|
|
|
template<typename T>
|
|
struct pointer {
|
|
explicit operator bool() const { return value; }
|
|
|
|
pointer() = default;
|
|
pointer(T* source) { value = source; }
|
|
pointer(const pointer& source) { value = source.value; }
|
|
|
|
auto& operator=(T* source) { value = source; return *this; }
|
|
auto& operator=(const pointer& source) { value = source.value; return *this; }
|
|
|
|
auto operator()() -> T* { return value; }
|
|
auto operator()() const -> const T* { return value; }
|
|
|
|
auto operator->() -> T* { return value; }
|
|
auto operator->() const -> const T* { return value; }
|
|
|
|
auto operator*() -> T& { return *value; }
|
|
auto operator*() const -> const T& { return *value; }
|
|
|
|
auto reset() -> void { value = nullptr; }
|
|
|
|
auto data() -> T* { return value; }
|
|
auto data() const -> const T* { return value; }
|
|
|
|
private:
|
|
T* value = nullptr;
|
|
};
|
|
|
|
}
|