diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-07-16 20:46:41 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-07-16 20:46:41 +0200 |
commit | 1361d7d36aca930f621ac1f5a68aae515eb6a28d (patch) | |
tree | be2e2e4e33ad54b5487627309c2d60a71da53e92 | |
parent | 339291fc674e6c021b1a1ae4aa63c6c4c73c5569 (diff) |
remove last <memory> usages
-rw-r--r-- | editor/vobj-editor.cpp | 6 | ||||
-rw-r--r-- | editor/vobj-editor.hpp | 4 | ||||
-rw-r--r-- | test/hash.cpp | 4 | ||||
-rw-r--r-- | test/json.cpp | 1 |
4 files changed, 7 insertions, 8 deletions
diff --git a/editor/vobj-editor.cpp b/editor/vobj-editor.cpp index cab9c0e1..6dc8c907 100644 --- a/editor/vobj-editor.cpp +++ b/editor/vobj-editor.cpp @@ -128,13 +128,13 @@ bptr<object> hole_factory::make(world& w, object_id id, global_coords pos) const auto vobj_editor::make_vobj_type_map() -> std::map<String, vobj_> { - constexpr auto add = [](auto& m, std::unique_ptr<vobj_factory>&& x) { + constexpr auto add = [](auto& m, Pointer<vobj_factory>&& x) { StringView name = x->name(), descr = x->descr(); m[name] = vobj_editor::vobj_{ name, descr, move(x) }; }; std::map<String, vobj_> map; - add(map, std::make_unique<light_factory>()); - add(map, std::make_unique<hole_factory>()); + add(map, Pointer<light_factory>{InPlace}); + add(map, Pointer<hole_factory>{InPlace}); return map; } diff --git a/editor/vobj-editor.hpp b/editor/vobj-editor.hpp index c614b4e7..0c6d8fcd 100644 --- a/editor/vobj-editor.hpp +++ b/editor/vobj-editor.hpp @@ -2,9 +2,9 @@ #include "src/object-type.hpp" #include "src/object-id.hpp" #include "compat/borrowed-ptr-fwd.hpp" -#include <memory> #include <map> #include <cr/String.h> +#include <cr/Pointer.h> namespace floormat { @@ -33,7 +33,7 @@ class vobj_editor final public: struct vobj_ final { String name, descr; - std::unique_ptr<vobj_factory> factory; + Pointer<vobj_factory> factory; }; vobj_editor(); diff --git a/test/hash.cpp b/test/hash.cpp index 2c6a7516..7582db43 100644 --- a/test/hash.cpp +++ b/test/hash.cpp @@ -4,8 +4,8 @@ #include "src/global-coords.hpp" #include "src/world.hpp" #include <cr/StringView.h> +#include <cr/Pointer.h> #include <bitset> -#include <memory> #include <mg/Functions.h> #ifdef __GNUG__ @@ -49,7 +49,7 @@ template<int16_t CoordMax, int8_t ZMax, uint32_t MaxCollisions> constexpr size_t Iters = (CoordMax*2 + 1)*(CoordMax*2 + 1)*(1+ZMax); // NOLINT(*-implicit-widening-of-multiplication-result) constexpr size_t BucketCount = Math::max(world::initial_capacity, size_t(Math::ceil(Iters / 0.2f))); uint32_t num_collisions = 0, iters = 0; - auto bitset_ = std::make_unique<std::bitset<BucketCount>>(false); + auto bitset_ = Pointer<std::bitset<BucketCount>>{InPlace, false}; auto& bitset = *bitset_; for (int16_t j = -CoordMax; j <= CoordMax; j++) diff --git a/test/json.cpp b/test/json.cpp index e9ed166f..c075d99c 100644 --- a/test/json.cpp +++ b/test/json.cpp @@ -9,7 +9,6 @@ #include "src/world.hpp" #include "loader/loader.hpp" #include "loader/wall-cell.hpp" -#include <memory> #include <Corrade/Containers/StringView.h> #include <Corrade/Utility/Path.h> |