[nostalgia/core] Give preload version of AssetRef a default constructor
This commit is contained in:
parent
b39a125264
commit
ab8b1e4925
@ -265,26 +265,28 @@ class AssetManager {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
class AssetRef {
|
class AssetRef {
|
||||||
private:
|
private:
|
||||||
T &m_obj;
|
const T *m_obj = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit constexpr AssetRef(T &obj) noexcept: m_obj(obj) {
|
constexpr AssetRef() noexcept = default;
|
||||||
|
|
||||||
|
explicit constexpr AssetRef(const T *obj) noexcept: m_obj(obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const T *get() const noexcept {
|
constexpr const T *get() const noexcept {
|
||||||
return &m_obj;
|
return m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const T &operator*() const & noexcept {
|
constexpr const T &operator*() const & noexcept {
|
||||||
return &m_obj;
|
return *m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const T &&operator*() const && noexcept {
|
constexpr const T &&operator*() const && noexcept {
|
||||||
return &m_obj;
|
return *m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const T *operator->() const noexcept {
|
constexpr const T *operator->() const noexcept {
|
||||||
return &m_obj;
|
return m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit constexpr operator bool() const noexcept {
|
explicit constexpr operator bool() const noexcept {
|
||||||
|
Loading…
Reference in New Issue
Block a user