[ox/std] Give UPter alias the other template parameter of UniquePtr
This commit is contained in:
parent
f169c96e78
commit
1298051a1a
18
deps/ox/src/ox/std/memory.hpp
vendored
18
deps/ox/src/ox/std/memory.hpp
vendored
@ -180,7 +180,7 @@ template<typename T, typename Deleter = DefaultDelete>
|
|||||||
class UniquePtr {
|
class UniquePtr {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T *m_t;
|
T *m_t = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) {
|
explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) {
|
||||||
@ -190,8 +190,8 @@ class UniquePtr {
|
|||||||
|
|
||||||
constexpr UniquePtr(const UniquePtr&) = delete;
|
constexpr UniquePtr(const UniquePtr&) = delete;
|
||||||
|
|
||||||
template<typename U>
|
template<typename U, typename UDeleter>
|
||||||
constexpr UniquePtr(UniquePtr<U> &&other) noexcept {
|
constexpr UniquePtr(UniquePtr<U, UDeleter> &&other) noexcept {
|
||||||
m_t = other.release();
|
m_t = other.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,16 +219,16 @@ class UniquePtr {
|
|||||||
|
|
||||||
constexpr UniquePtr &operator=(const UniquePtr<T> &other) = delete;
|
constexpr UniquePtr &operator=(const UniquePtr<T> &other) = delete;
|
||||||
|
|
||||||
template<typename U>
|
template<typename U, typename UDeleter>
|
||||||
constexpr UniquePtr &operator=(const UniquePtr<U> &other) = delete;
|
constexpr UniquePtr &operator=(const UniquePtr<U, UDeleter> &other) = delete;
|
||||||
|
|
||||||
constexpr UniquePtr &operator=(UniquePtr<T> &&other) noexcept {
|
constexpr UniquePtr &operator=(UniquePtr<T> &&other) noexcept {
|
||||||
reset(std::move(other));
|
reset(std::move(other));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U>
|
template<typename U, typename UDeleter>
|
||||||
constexpr UniquePtr &operator=(UniquePtr<U> &&other) noexcept {
|
constexpr UniquePtr &operator=(UniquePtr<U, UDeleter> &&other) noexcept {
|
||||||
reset(std::move(other));
|
reset(std::move(other));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -247,8 +247,8 @@ class UniquePtr {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T, typename Deleter = DefaultDelete>
|
||||||
using UPtr = UniquePtr<T>;
|
using UPtr = UniquePtr<T, Deleter>;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr bool operator==(const UniquePtr<T> &p1, const UniquePtr<T> &p2) noexcept {
|
constexpr bool operator==(const UniquePtr<T> &p1, const UniquePtr<T> &p2) noexcept {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user