From 5a0b3927a33807cca4c77c40eb873f8a3b51b0b0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 29 Apr 2023 19:07:11 +0100 Subject: Drop .hpp for header only things Half of them acquired a .cpp part anyway --- lib/ptr.hpp | 67 ------------------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 lib/ptr.hpp (limited to 'lib/ptr.hpp') diff --git a/lib/ptr.hpp b/lib/ptr.hpp deleted file mode 100644 index 931df39..0000000 --- a/lib/ptr.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include -#include - -template class wrapped_ptr { -public: - template - explicit wrapped_ptr(Obj * (*factory)(Params...), Args &&... args) : obj {factory(std::forward(args)...)} - { - } - - explicit wrapped_ptr(wrapped_ptr && p) : obj {p.obj} - { - p.obj = nullptr; - } - - ~wrapped_ptr() - { - if (obj) { - Destroy(obj); - } - } - - NO_COPY(wrapped_ptr); - - wrapped_ptr & - operator=(wrapped_ptr && p) - { - if (obj) { - Destroy(obj); - } - obj = p.obj; - p.obj = nullptr; - return *this; - } - - [[nodiscard]] inline - operator Obj *() const noexcept - { - return obj; - } - - [[nodiscard]] inline auto - operator->() const noexcept - { - return obj; - } - - [[nodiscard]] inline auto - get() const noexcept - { - return obj; - } - -protected: - explicit wrapped_ptr(Obj * o) : obj {o} { } - Obj * obj; -}; - -template class wrapped_ptrt : public wrapped_ptr { -public: - template - explicit wrapped_ptrt(Args &&... args) : wrapped_ptr {Create(std::forward(args)...)} - { - } -}; -- cgit v1.2.3