[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 {
|
||||
|
||||
private:
|
||||
T *m_t;
|
||||
T *m_t = nullptr;
|
||||
|
||||
public:
|
||||
explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) {
|
||||
@ -190,8 +190,8 @@ class UniquePtr {
|
||||
|
||||
constexpr UniquePtr(const UniquePtr&) = delete;
|
||||
|
||||
template<typename U>
|
||||
constexpr UniquePtr(UniquePtr<U> &&other) noexcept {
|
||||
template<typename U, typename UDeleter>
|
||||
constexpr UniquePtr(UniquePtr<U, UDeleter> &&other) noexcept {
|
||||
m_t = other.release();
|
||||
}
|
||||
|
||||
@ -219,16 +219,16 @@ class UniquePtr {
|
||||
|
||||
constexpr UniquePtr &operator=(const UniquePtr<T> &other) = delete;
|
||||
|
||||
template<typename U>
|
||||
constexpr UniquePtr &operator=(const UniquePtr<U> &other) = delete;
|
||||
template<typename U, typename UDeleter>
|
||||
constexpr UniquePtr &operator=(const UniquePtr<U, UDeleter> &other) = delete;
|
||||
|
||||
constexpr UniquePtr &operator=(UniquePtr<T> &&other) noexcept {
|
||||
reset(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
constexpr UniquePtr &operator=(UniquePtr<U> &&other) noexcept {
|
||||
template<typename U, typename UDeleter>
|
||||
constexpr UniquePtr &operator=(UniquePtr<U, UDeleter> &&other) noexcept {
|
||||
reset(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
@ -247,8 +247,8 @@ class UniquePtr {
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using UPtr = UniquePtr<T>;
|
||||
template<typename T, typename Deleter = DefaultDelete>
|
||||
using UPtr = UniquePtr<T, Deleter>;
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator==(const UniquePtr<T> &p1, const UniquePtr<T> &p2) noexcept {
|
||||
|
Loading…
Reference in New Issue
Block a user