diff options
45 files changed, 104 insertions, 126 deletions
diff --git a/anim-crop-tool/main.cpp b/anim-crop-tool/main.cpp index 919e80d3..7ba31b6e 100644 --- a/anim-crop-tool/main.cpp +++ b/anim-crop-tool/main.cpp @@ -19,7 +19,6 @@ #include <Corrade/Utility/Arguments.h> #include <Corrade/Utility/DebugStl.h> -#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Path.h> #include <Magnum/Math/Functions.h> @@ -82,7 +81,7 @@ bool load_file(anim_group& group, options& opts, anim_atlas_& atlas, StringView Error{} << "error: failed to load" << filename << "as RGBA32 image"; return cv::Mat4b{}; } - return cv::Mat4b(Utility::move(mat)); + return cv::Mat4b(move(mat)); }(); if (mat.empty()) @@ -128,7 +127,7 @@ bool load_file(anim_group& group, options& opts, anim_atlas_& atlas, StringView const Vector2ui dest_size_ = { (unsigned)dest_size.width, (unsigned)dest_size.height }; arrayAppend(group.frames, {ground, atlas.offset(), dest_size_}); - atlas.add_entry({&group.frames.back(), Utility::move(resized)}); + atlas.add_entry({&group.frames.back(), move(resized)}); return true; } @@ -232,7 +231,7 @@ arg_tuple parse_cmdline(int argc, const char* const* argv) noexcept if (opts.output_dir.isEmpty()) opts.output_dir = opts.input_dir; - return { Utility::move(opts), Utility::move(args), true }; + return { move(opts), move(args), true }; } [[nodiscard]] int usage(const Arguments& args) noexcept diff --git a/compat/debug.hpp b/compat/debug.hpp index 1fdd9a7e..07421673 100644 --- a/compat/debug.hpp +++ b/compat/debug.hpp @@ -1,6 +1,5 @@ #pragma once #include <Corrade/Utility/Debug.h> -#include <Corrade/Utility/Move.h> #include <Corrade/Containers/StringView.h> #include <concepts> @@ -70,11 +69,11 @@ auto quoted(T&& value, char c = '\'') using U = std::remove_cvref_t<T>; using floormat::detail::corrade_debug::Quoted; if constexpr(std::is_rvalue_reference_v<decltype(value)>) - return Quoted<U>{ .value = Utility::move(value), .c = c }; + return Quoted<U>{ .value = move(value), .c = c }; else return Quoted<const U&>{ .value = value, .c = c }; } -template<DebugPrintable T> auto quoted2(T&& value) { return quoted(Utility::forward<T>(value), '"'); } +template<DebugPrintable T> auto quoted2(T&& value) { return quoted(forward<T>(value), '"'); } } // namespace floormat diff --git a/compat/exception.hpp b/compat/exception.hpp index 155547de..8b9b8763 100644 --- a/compat/exception.hpp +++ b/compat/exception.hpp @@ -3,7 +3,6 @@ #include <type_traits> #include <iterator> #include <exception> -#include <Corrade/Utility/Move.h> namespace floormat { @@ -27,7 +26,7 @@ private: template<typename Fmt, typename... Ts> exception::exception(const Fmt& fmt, Ts&&... args) noexcept { - fmt::format_to(std::back_inserter(buf), fmt, Corrade::Utility::forward<Ts>(args)...); // todo remove <iterator> + fmt::format_to(std::back_inserter(buf), fmt, forward<Ts>(args)...); // todo remove <iterator> buf.push_back('\0'); } diff --git a/compat/format.hpp b/compat/format.hpp index d0736c97..1cb4f365 100644 --- a/compat/format.hpp +++ b/compat/format.hpp @@ -4,7 +4,6 @@ #include <fmt/compile.h> #include <Corrade/Containers/StringView.h> #include <Corrade/Containers/String.h> -#include <Corrade/Utility/Move.h> namespace fmt { @@ -52,7 +51,7 @@ template<size_t N, typename Fmt, typename... Xs> size_t snformat(char(&buf)[N], Fmt&& fmt, Xs&&... args) { constexpr size_t n = N > 0 ? N - 1 : 0; - auto result = fmt::format_to_n(buf, n, Corrade::Utility::forward<Fmt>(fmt), Corrade::Utility::forward<Xs>(args)...); + auto result = fmt::format_to_n(buf, n, forward<Fmt>(fmt), forward<Xs>(args)...); const auto len = n < result.size ? n : result.size; fm_assert(len > 0); #if 0 diff --git a/compat/heap.hpp b/compat/heap.hpp index e9cac8cf..3d901755 100644 --- a/compat/heap.hpp +++ b/compat/heap.hpp @@ -16,11 +16,11 @@ inline void _push_heap(It first, std::iter_difference_t<It> parent = (holeIndex - 1) / 2; while (holeIndex > topIndex && comp(*(first + parent), value)) { - *(first + holeIndex) = std::move(*(first + parent)); + *(first + holeIndex) = move(*(first + parent)); holeIndex = parent; parent = (holeIndex - 1) / 2; } - *(first + holeIndex) = std::move(value); + *(first + holeIndex) = move(value); } template<typename It, typename Compare> @@ -29,7 +29,7 @@ void push_heap(It first, It last, Compare comp) _push_heap(first, std::iter_difference_t<It>((last - first) - 1), std::iter_difference_t<It>(0), - std::move(*(last - 1)), + move(*(last - 1)), comp); } @@ -47,16 +47,16 @@ void _adjust_heap(It first, secondChild = 2 * (secondChild + 1); if (comp(*(first + secondChild), *(first + (secondChild - 1)))) secondChild--; - *(first + holeIndex) = std::move(*(first + secondChild)); + *(first + holeIndex) = move(*(first + secondChild)); holeIndex = secondChild; } if ((len & 1) == 0 && secondChild == (len - 2) / 2) { secondChild = 2 * (secondChild + 1); - *(first + holeIndex) = std::move(*(first + (secondChild - 1))); + *(first + holeIndex) = move(*(first + (secondChild - 1))); holeIndex = secondChild - 1; } - _push_heap(first, holeIndex, topIndex, std::move(value), comp); + _push_heap(first, holeIndex, topIndex, move(value), comp); } template<typename It, typename Compare> @@ -65,12 +65,12 @@ void pop_heap(It first, It last, Compare comp) if (last - first > 1) { --last; - auto value = std::move(*last); - *last = std::move(*first); + auto value = move(*last); + *last = move(*first); _adjust_heap(first, std::iter_difference_t<It>(0), std::iter_difference_t<It>(last - first), - std::move(value), + move(value), comp); } } diff --git a/compat/intrusive-ptr.hpp b/compat/intrusive-ptr.hpp index 0d09a366..7cc15494 100644 --- a/compat/intrusive-ptr.hpp +++ b/compat/intrusive-ptr.hpp @@ -1,7 +1,6 @@ #pragma once #include "compat/assert.hpp" #include <compare> -#include <Corrade/Utility/Move.h> namespace floormat::iptr { struct non_atomic_u32_tag{}; } @@ -273,7 +272,7 @@ fm_template template<typename... Ts> requires std::is_constructible_v<T, Ts&&...> constexpr fm_basic_iptr::basic_iptr(InPlaceInitT, Ts&&... args) // NOLINT(*-missing-std-forward) noexcept(std::is_nothrow_constructible_v<T, Ts&&...>): - _ptr{new T{Utility::forward<Ts...>(args...)}} + _ptr{new T{forward<Ts...>(args...)}} { ops_t::init_to_1(_ptr); } diff --git a/compat/safe-ptr.hpp b/compat/safe-ptr.hpp index 68c17c76..2a77ea72 100644 --- a/compat/safe-ptr.hpp +++ b/compat/safe-ptr.hpp @@ -3,7 +3,6 @@ #include "compat/defs.hpp" #include <type_traits> #include <Corrade/Tags.h> -#include <Corrade/Utility/Move.h> namespace floormat { @@ -26,7 +25,7 @@ public: safe_ptr() noexcept: safe_ptr{InPlaceInit} {} template<typename... Ts> safe_ptr(InPlaceInitT, Ts&&... args) noexcept: - ptr(new T{ Utility::forward<Ts>(args)... }) + ptr(new T{ forward<Ts>(args)... }) {} safe_ptr(const safe_ptr& other) noexcept: diff --git a/draw/wireframe.cpp b/draw/wireframe.cpp index 12734fcd..4a2233f6 100644 --- a/draw/wireframe.cpp +++ b/draw/wireframe.cpp @@ -22,7 +22,7 @@ GL::Texture2D make_constant_texture() .setMagnificationFilter(GL::SamplerFilter::Nearest) .setMinificationFilter(GL::SamplerFilter::Nearest) .setStorage(1, GL::textureFormat(img.format()), img.size()) - .setSubImage(0, {}, std::move(img)); + .setSubImage(0, {}, move(img)); return tex; } diff --git a/editor/app.cpp b/editor/app.cpp index aa655612..db395b98 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -13,7 +13,6 @@ #include <cstring> #include <Corrade/Containers/StringIterable.h> #include <Corrade/Utility/Arguments.h> -#include <Corrade/Utility/Move.h> namespace floormat { @@ -95,7 +94,7 @@ void app::reset_world(class world&& w_) _render_vobjs = true; _render_all_z_levels = true; - auto& w = M->reset_world(Utility::move(w_)); + auto& w = M->reset_world(move(w_)); w.collect(true); ensure_player_character(w); update_cursor_tile(pixel); @@ -186,7 +185,7 @@ int app::run_from_argv(const int argc, const char* const* const argv) opts.argv = argv; opts.argc = argc; - struct app* A = new app{Utility::move(opts)}; + struct app* A = new app{move(opts)}; floormat_main* M = A->M; fm_assert(M != nullptr); ret = A->exec(); diff --git a/editor/ctor.cpp b/editor/ctor.cpp index 36a35ae5..6b35b34c 100644 --- a/editor/ctor.cpp +++ b/editor/ctor.cpp @@ -10,7 +10,7 @@ namespace floormat { app::app(fm_settings&& opts) : - M{floormat_main::create(*this, Utility::move(opts))}, + M{floormat_main::create(*this, move(opts))}, _imgui{InPlaceInit, NoCreate}, _wireframe{InPlaceInit}, _tests{tests_data_::make()}, diff --git a/editor/ground-editor.cpp b/editor/ground-editor.cpp index 4c5316a0..49f636ce 100644 --- a/editor/ground-editor.cpp +++ b/editor/ground-editor.cpp @@ -122,7 +122,6 @@ void fisher_yates(T begin, T end) for (auto i = N-1; i >= 1; i--) { const auto j = random(i+1); - using std::swap; swap(begin[i], begin[j]); } } diff --git a/editor/inspect.cpp b/editor/inspect.cpp index 29e7d193..d52ee5e2 100644 --- a/editor/inspect.cpp +++ b/editor/inspect.cpp @@ -54,7 +54,7 @@ int corrade_string_resize_callback(ImGuiInputTextCallbackData* data) if ((size_t)data->BufSize > str.size()+1) { auto str2 = String{ValueInit, (size_t)data->BufSize}; - str = std::move(str2); + str = move(str2); data->Buf = str.data(); } } diff --git a/editor/inspect.hpp b/editor/inspect.hpp index df543f96..49abc5ce 100644 --- a/editor/inspect.hpp +++ b/editor/inspect.hpp @@ -7,9 +7,9 @@ struct erased_accessor; template<typename T, typename Enum, Enum As> struct field_repr_ final { - field_repr_(T x) : value{std::move(x)} {} + field_repr_(T x) : value{move(x)} {} field_repr_(const field_repr_<T, Enum, As>& other) noexcept = default; - field_repr_& operator=(T x) noexcept { value = std::move(x); return *this; } + field_repr_& operator=(T x) noexcept { value = move(x); return *this; } field_repr_& operator=(const field_repr_<T, Enum, As>& x) noexcept = default; field_repr_& operator*() const noexcept { return value; } operator T() const noexcept { return value; } diff --git a/editor/tests/path-test.cpp b/editor/tests/path-test.cpp index 68c7fee9..6bb89bef 100644 --- a/editor/tests/path-test.cpp +++ b/editor/tests/path-test.cpp @@ -161,7 +161,7 @@ void path_test::update_pre(app& a) result = { .from = pending.from, .to = pending.to, - .path = std::move(res.raw_path().vec), + .path = move(res.raw_path().vec), .time = res.time(), .cost = res.cost(), .distance = res.distance(), diff --git a/editor/vobj-editor.cpp b/editor/vobj-editor.cpp index 0cfa64d6..f644ca1c 100644 --- a/editor/vobj-editor.cpp +++ b/editor/vobj-editor.cpp @@ -98,7 +98,7 @@ auto vobj_editor::make_vobj_type_map() -> std::map<String, vobj_> { constexpr auto add = [](auto& m, std::unique_ptr<vobj_factory>&& x) { StringView name = x->name(), descr = x->descr(); - m[name] = vobj_editor::vobj_{ name, descr, std::move(x) }; + m[name] = vobj_editor::vobj_{ name, descr, move(x) }; }; std::map<String, vobj_> map; add(map, std::make_unique<light_factory>()); diff --git a/entity/metadata.hpp b/entity/metadata.hpp index 16a4422d..41c57186 100644 --- a/entity/metadata.hpp +++ b/entity/metadata.hpp @@ -7,13 +7,11 @@ #include "compat/defs.hpp" #include <type_traits> #include <concepts> -#include <utility> #include <limits> #include <tuple> #include <array> #include <compat/function2.hpp> #include <Corrade/Containers/StringView.h> -#include <Corrade/Utility/Move.h> namespace floormat::entities { @@ -36,7 +34,7 @@ constexpr CORRADE_ALWAYS_INLINE void visit_tuple(F&& fun, Tuple&& tuple) fun(std::get<N>(tuple)); if constexpr(N+1 < Size()) - visit_tuple<F, Tuple, N+1>(Corrade::Utility::forward<F>(fun), Corrade::Utility::forward<Tuple>(tuple)); + visit_tuple<F, Tuple, N+1>(floormat::forward<F>(fun), floormat::forward<Tuple>(tuple)); } template<typename F, typename Tuple, size_t N> @@ -49,7 +47,7 @@ constexpr CORRADE_ALWAYS_INLINE bool find_in_tuple(F&& fun, Tuple&& tuple) if (fun(std::get<N>(tuple))) return true; if constexpr(N+1 < Size()) - return find_in_tuple<F, Tuple, N+1>(Corrade::Utility::forward<F>(fun), Corrade::Utility::forward<Tuple>(tuple)); + return find_in_tuple<F, Tuple, N+1>(floormat::forward<F>(fun), floormat::forward<Tuple>(tuple)); return false; } @@ -123,7 +121,7 @@ public: static constexpr decltype(auto) read(const R& reader, const Obj& x) { return detail::read_field<Obj, Type, R>::read(x, reader); } static constexpr void write(const W& writer, Obj& x, Type v); constexpr decltype(auto) read(const Obj& x) const { return read(reader, x); } - constexpr void write(Obj& x, Type value) const { write(writer, x, Corrade::Utility::move(value)); } + constexpr void write(Obj& x, Type value) const { write(writer, x, move(value)); } static constexpr bool can_write = !std::is_same_v<std::nullptr_t, decltype(entity_field<Obj, Type, R, W, Ts...>::writer)>; static constexpr field_status is_enabled(const Predicate & p, const Obj& x); @@ -146,7 +144,7 @@ public: template<typename Obj, typename Type, FieldReader<Obj, Type> R, FieldWriter<Obj, Type> W, typename... Ts> constexpr void entity_field<Obj, Type, R, W, Ts...>::write(const W& writer, Obj& x, Type v) { - static_assert(can_write); detail::write_field<Obj, Type, W>::write(x, writer, Corrade::Utility::move(v)); + static_assert(can_write); detail::write_field<Obj, Type, W>::write(x, writer, move(v)); } template<typename Obj, typename Type, FieldReader<Obj, Type> R, FieldWriter<Obj, Type> W, typename... Ts> @@ -168,8 +166,8 @@ constexpr erased_accessor entity_field<Obj, Type, R, W, Ts...>::erased() const constexpr auto writer_fn = [](void* obj, const writer_t* writer, void* value) { auto& obj_ = *reinterpret_cast<Obj*>(obj); const auto& writer_ = *reinterpret_cast<const W*>(writer); - Type value_ = Corrade::Utility::move(*reinterpret_cast<Type*>(value)); - write(writer_, obj_, Corrade::Utility::move(value_)); + Type value_ = move(*reinterpret_cast<Type*>(value)); + write(writer_, obj_, move(value_)); }; constexpr auto predicate_fn = [](const void* obj, const predicate_t* predicate) { const auto& obj_ = *reinterpret_cast<const Obj*>(obj); @@ -221,7 +219,7 @@ struct Entity final { struct field final : entity_field<Obj, Type, R, W, Ts...> { constexpr field(StringView field_name, R r, W w, Ts&&... ts) noexcept : - entity_field<Obj, Type, R, W, Ts...>{field_name, r, w, Corrade::Utility::forward<Ts>(ts)...} + entity_field<Obj, Type, R, W, Ts...>{field_name, r, w, floormat::forward<Ts>(ts)...} {} }; @@ -235,7 +233,7 @@ constexpr void visit_tuple(F&& fun, Tuple&& tuple) { using Size = std::tuple_size<std::decay_t<Tuple>>; if constexpr(Size() > 0) - detail::visit_tuple<F, Tuple, 0>(Corrade::Utility::forward<F>(fun), Corrade::Utility::forward<Tuple>(tuple)); + detail::visit_tuple<F, Tuple, 0>(floormat::forward<F>(fun), floormat::forward<Tuple>(tuple)); } template<typename F, typename Tuple> @@ -243,7 +241,7 @@ constexpr bool find_in_tuple(F&& fun, Tuple&& tuple) { using Size = std::tuple_size<std::decay_t<Tuple>>; if constexpr(Size() > 0) - return detail::find_in_tuple<F, Tuple, 0>(Corrade::Utility::forward<F>(fun), Corrade::Utility::forward<Tuple>(tuple)); + return detail::find_in_tuple<F, Tuple, 0>(floormat::forward<F>(fun), floormat::forward<Tuple>(tuple)); else return false; } diff --git a/include/cr/Move.h b/include/cr/Move.h deleted file mode 100644 index 47194929..00000000 --- a/include/cr/Move.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -#include <Corrade/Utility/Move.h> diff --git a/loader/anim-traits.cpp b/loader/anim-traits.cpp index 2fe706ed..524f4c24 100644 --- a/loader/anim-traits.cpp +++ b/loader/anim-traits.cpp @@ -7,7 +7,6 @@ #include "serialize/json-helper.hpp" #include "serialize/anim.hpp" #include "compat/exception.hpp" -#include <cr/Move.h> #include <cr/StringView.h> #include <cr/GrowableArray.h> #include <cr/StridedArrayView.h> @@ -53,12 +52,12 @@ auto anim_traits::make_invalid_atlas(Storage& s) -> Cell auto def = anim_def { .object_name = loader.INVALID, .anim_name = loader.INVALID, - .groups = Utility::move(groups), + .groups = move(groups), .pixel_size = size, .scale = anim_scale::fixed{size.x(), true}, .nframes = 1, }; - auto atlas = std::make_shared<class anim_atlas>(loader.INVALID, loader.make_error_texture(size), std::move(def)); + auto atlas = std::make_shared<class anim_atlas>(loader.INVALID, loader.make_error_texture(size), move(def)); auto info = anim_cell { .atlas = atlas, .name = loader.INVALID, @@ -97,7 +96,7 @@ auto anim_traits::make_atlas(StringView name, const Cell&) -> std::shared_ptr<At const auto width = size[1], height = size[0]; fm_soft_assert(anim_info.pixel_size[0] == width && anim_info.pixel_size[1] == height); - auto atlas = std::make_shared<class anim_atlas>(name, tex, std::move(anim_info)); + auto atlas = std::make_shared<class anim_atlas>(name, tex, move(anim_info)); return atlas; } diff --git a/loader/atlas-loader.inl b/loader/atlas-loader.inl index 490ff3a4..8b5f9595 100644 --- a/loader/atlas-loader.inl +++ b/loader/atlas-loader.inl @@ -8,14 +8,13 @@ #include <memory> #include <cr/ArrayView.h> #include <cr/Optional.h> -#include <cr/Move.h> #include <cr/GrowableArray.h> namespace floormat::loader_detail { template<typename ATLAS, typename TRAITS> atlas_loader<ATLAS, TRAITS>::atlas_loader(TRAITS&& traits): // NOLINT(*-rvalue-reference-param-not-moved) - t{Utility::move(traits)} + t{move(traits)} { arrayReserve(s.missing_atlas_names, 8); } @@ -138,7 +137,7 @@ auto atlas_loader<ATLAS, TRAITS>::get_atlas(StringView name, const loader_policy fm_assert(!t.atlas_of(*c_)); fm_assert(t.name_of(*c_) == name); const size_t index{s.cell_array.size()}; - arrayAppend(s.cell_array, Utility::move(*c_)); + arrayAppend(s.cell_array, move(*c_)); Cell& c{s.cell_array.back()}; String& name_{t.name_of(c)}; if (name_.isSmall()) name_ = String{AllocatedInit, name_}; @@ -223,7 +222,7 @@ void atlas_loader<ATLAS, TRAITS>::register_cell(Cell&& c) fm_assert(!s.name_map.contains(name)); fm_soft_assert(loader.check_atlas_name(name)); const size_t index{s.cell_array.size()}; - arrayAppend(s.cell_array, Utility::move(c)); + arrayAppend(s.cell_array, move(c)); if (String& name_ = t.name_of(s.cell_array.back()); name_.isSmall()) name_ = String{AllocatedInit, name_}; s.name_map[ t.name_of(s.cell_array.back()) ] = index; } diff --git a/loader/error-tex.cpp b/loader/error-tex.cpp index 16df2b43..dac5992c 100644 --- a/loader/error-tex.cpp +++ b/loader/error-tex.cpp @@ -18,7 +18,7 @@ Trade::ImageData2D loader_impl::make_error_texture(Vector2ui size) *(Vector4ub*)data = magenta; data += 4; } - auto img = Trade::ImageData2D{PixelFormat::RGBA8Unorm, Vector2i(size), std::move(array)}; + auto img = Trade::ImageData2D{PixelFormat::RGBA8Unorm, Vector2i(size), move(array)}; return img; } diff --git a/loader/filesystem.cpp b/loader/filesystem.cpp index be3aa1df..009a3d22 100644 --- a/loader/filesystem.cpp +++ b/loader/filesystem.cpp @@ -49,7 +49,7 @@ void loader_impl::set_application_working_directory() return; once = true; if (auto loc = Path::currentDirectory(); loc) - original_working_directory = std::move(*loc); + original_working_directory = move(*loc); else { auto err = error_string(); diff --git a/loader/texture.cpp b/loader/texture.cpp index e93b21af..0da6f1e7 100644 --- a/loader/texture.cpp +++ b/loader/texture.cpp @@ -40,7 +40,7 @@ Trade::ImageData2D loader_impl::texture(StringView prefix, StringView filename_) auto img = importer->image2D(0); if (!img) fm_abort("can't allocate image for '%s'", buf); - auto ret = std::move(*img); + auto ret = move(*img); return ret; } } diff --git a/loader/vobj.cpp b/loader/vobj.cpp index 010cc642..f09c9581 100644 --- a/loader/vobj.cpp +++ b/loader/vobj.cpp @@ -70,9 +70,9 @@ std::shared_ptr<class anim_atlas> loader_impl::make_vobj_anim_atlas(StringView n }, }; def.groups = Array<anim_group>{1}; - def.groups[0] = std::move(group); + def.groups[0] = move(group); } - auto atlas = std::make_shared<class anim_atlas>(name, tex, std::move(def)); + auto atlas = std::make_shared<class anim_atlas>(name, tex, move(def)); return atlas; } @@ -92,7 +92,7 @@ void loader_impl::get_vobj_list() { auto atlas = make_vobj_anim_atlas(name, img_name); auto info = vobj_cell{name, descr, atlas}; - vobjs.push_back(std::move(info)); + vobjs.push_back(move(info)); const auto& x = vobjs.back(); vobj_atlas_map[x.atlas->name()] = &x; } diff --git a/loader/wall-traits.cpp b/loader/wall-traits.cpp index 37056746..9bf23ff9 100644 --- a/loader/wall-traits.cpp +++ b/loader/wall-traits.cpp @@ -42,7 +42,7 @@ auto wall_traits::make_invalid_atlas(Storage& s) -> Cell {{ {.val = 0}, {}, }}, {1u}, }, name, loader.make_error_texture(frame_size)); - return { .atlas = std::move(a), .name = name, }; + return { .atlas = move(a), .name = name, }; } auto wall_traits::make_atlas(StringView name, const Cell&) -> std::shared_ptr<Atlas> @@ -56,7 +56,7 @@ auto wall_traits::make_atlas(StringView name, const Cell&) -> std::shared_ptr<At fm_soft_assert(name == def.header.name); fm_soft_assert(!def.frames.isEmpty()); auto tex = loader.texture(""_s, file); - auto atlas = std::make_shared<class wall_atlas>(std::move(def), file, tex); + auto atlas = std::make_shared<class wall_atlas>(move(def), file, tex); return atlas; } diff --git a/main/ctor.cpp b/main/ctor.cpp index 69f965c9..da38fb18 100644 --- a/main/ctor.cpp +++ b/main/ctor.cpp @@ -10,7 +10,7 @@ namespace floormat { main_impl::main_impl(floormat_app& app, fm_settings&& se, int& argc, char** argv) noexcept : Platform::Sdl2Application{Arguments{argc, argv}, make_conf(se), make_gl_conf(se)}, - s{std::move(se)}, app{app}, _shader{_tuc} + s{move(se)}, app{app}, _shader{_tuc} { if (s.vsync) { @@ -29,7 +29,7 @@ main_impl::main_impl(floormat_app& app, fm_settings&& se, int& argc, char** argv class world& main_impl::reset_world(class world&& w) noexcept { arrayResize(_clickable_scenery, 0); - _world = std::move(w); + _world = move(w); return _world; } diff --git a/main/main-impl.cpp b/main/main-impl.cpp index fde0861d..11561a4a 100644 --- a/main/main-impl.cpp +++ b/main/main-impl.cpp @@ -1,7 +1,6 @@ #include "main-impl.hpp" #include "src/search-astar.hpp" #include "src/search.hpp" -#include <Corrade/Utility/Move.h> #include <Magnum/Platform/Sdl2Application.h> namespace floormat { @@ -37,7 +36,7 @@ int main_impl::exec() floormat_main* floormat_main::create(floormat_app& app, fm_settings&& options) { - auto* ret = new main_impl(app, Utility::move(options), options.argc, const_cast<char**>(options.argv)); + auto* ret = new main_impl(app, move(options), options.argc, const_cast<char**>(options.argv)); return ret; } diff --git a/serialize/binary-reader.inl b/serialize/binary-reader.inl index b8bf6484..d19534f9 100644 --- a/serialize/binary-reader.inl +++ b/serialize/binary-reader.inl @@ -12,7 +12,7 @@ constexpr binary_reader<It>::binary_reader(const Seq& seq) noexcept template<string_input_iterator It> constexpr binary_reader<It>::binary_reader(It begin, It end) noexcept : - it{std::move(begin)}, end{std::move(end)} + it{move(begin)}, end{move(end)} {} template<string_input_iterator It> diff --git a/serialize/ground-atlas.cpp b/serialize/ground-atlas.cpp index 6844019c..d563bb05 100644 --- a/serialize/ground-atlas.cpp +++ b/serialize/ground-atlas.cpp @@ -8,7 +8,6 @@ #include "serialize/magnum-vector.hpp" #include "serialize/pass-mode.hpp" #include <tuple> -#include <Corrade/Utility/Move.h> #include <Magnum/Trade/ImageData.h> #include <Magnum/ImageView.h> #include <nlohmann/json.hpp> @@ -58,7 +57,7 @@ void adl_serializer<std::shared_ptr<ground_atlas>>::to_json(json& j, const std:: void adl_serializer<std::shared_ptr<ground_atlas>>::from_json(const json& j, std::shared_ptr<ground_atlas>& val) { ground_def def = j; - val = std::make_shared<ground_atlas>(std::move(def), loader.texture(loader.GROUND_TILESET_PATH, def.name)); + val = std::make_shared<ground_atlas>(move(def), loader.texture(loader.GROUND_TILESET_PATH, def.name)); } } // namespace nlohmann diff --git a/serialize/packbits-read.hpp b/serialize/packbits-read.hpp index d2622d49..4ad3aa74 100644 --- a/serialize/packbits-read.hpp +++ b/serialize/packbits-read.hpp @@ -4,7 +4,6 @@ #include <type_traits> #include <concepts> #include <tuple> -#include <Corrade/Utility/Move.h> namespace floormat::Pack_impl { @@ -103,7 +102,7 @@ constexpr CORRADE_ALWAYS_INLINE void read_(Tuple&& tuple, input<T, Left> st, std using next_type = typename input<T, Left>::template next<Size>; std::get<I>(tuple).value = st.template get<Size>(); T next_value = st.template advance<Size>(); - read_(Utility::forward<Tuple>(tuple), next_type{ next_value }, std::index_sequence<Is...>{}); + read_(floormat::forward<Tuple>(tuple), next_type{ next_value }, std::index_sequence<Is...>{}); } template<std::unsigned_integral T, typename Tuple, size_t Left> @@ -125,7 +124,7 @@ requires requires (const Tuple& tuple) { { constexpr size_t nbits = sizeof(T)*8, tuple_size = std::tuple_size_v<std::decay_t<Tuple>>; - Pack_impl::read_(Utility::forward<Tuple>(tuple), + Pack_impl::read_(floormat::forward<Tuple>(tuple), Pack_impl::input<T, nbits>{value}, std::make_index_sequence<tuple_size>{}); } diff --git a/serialize/savegame.cpp b/serialize/savegame.cpp index d84ce143..10f4d1cf 100644 --- a/serialize/savegame.cpp +++ b/serialize/savegame.cpp @@ -473,7 +473,7 @@ ok: intern_atlas_(atlas, type, byte_writer{s}); auto id = (uint32_t)atlas_array.size(); fm_assert(s.bytes_written() == s.bytes_allocated()); - atlas_array.emplace_back(std::move(buf), atlas, type); + atlas_array.emplace_back(move(buf), atlas, type); kv.value() = id; fm_assert(id < null<atlasid>); return atlasid{id}; @@ -628,7 +628,7 @@ ok: b.write_asciiz_string(s); } fm_assert(b.bytes_written() == b.bytes_allocated()); - string_buf = std::move(buf); + string_buf = move(buf); } void serialize_world() @@ -659,7 +659,7 @@ ok: binary_writer s{&hdr.data[0], hdr.size}; serialize_header_(byte_writer{s}); fm_assert(s.bytes_written() == s.bytes_allocated()); - header_buf = std::move(hdr); + header_buf = move(hdr); } serialize_strings_(); @@ -982,19 +982,19 @@ ok: deserialize_tile_part<atlasid>([&](uint32_t i, uint32_t id) { auto name = get_atlas<atlas_type::ground>(id); auto a = loader.ground_atlas(name, loader_policy::warn); - c[i].ground() = { std::move(a), (variant_t)-1 }; + c[i].ground() = { move(a), (variant_t)-1 }; }, i, r); for (uint32_t i = 0; i < TILE_COUNT; i++) deserialize_tile_part<atlasid>([&](uint32_t i, uint32_t id) { auto name = get_atlas<atlas_type::wall>(id); auto a = loader.wall_atlas(name, loader_policy::warn); - c[i].wall_north() = { std::move(a), (variant_t)-1 }; + c[i].wall_north() = { move(a), (variant_t)-1 }; }, i, r); for (uint32_t i = 0; i < TILE_COUNT; i++) deserialize_tile_part<atlasid>([&](uint32_t i, uint32_t id) { auto name = get_atlas<atlas_type::wall>(id); auto a = loader.wall_atlas(name, loader_policy::warn); - c[i].wall_west() = { std::move(a), (variant_t)-1 }; + c[i].wall_west() = { move(a), (variant_t)-1 }; }, i, r); for (uint32_t i = 0; i < TILE_COUNT; i++) deserialize_tile_part<variant_t>([&](uint32_t i, variant_t id) { @@ -1052,7 +1052,7 @@ class world world::deserialize(StringView filename, loader_policy asset_policy) if (auto ret = std::fread(&buf_[0], 1, len+1, f); ret != len) fm_throw("fread short read: {}"_cf, get_error_string(errbuf)); - buf.data = std::move(buf_); + buf.data = move(buf_); buf.size = len; } diff --git a/serialize/wall-atlas.cpp b/serialize/wall-atlas.cpp index 4e661674..3e120bb5 100644 --- a/serialize/wall-atlas.cpp +++ b/serialize/wall-atlas.cpp @@ -109,7 +109,7 @@ wall_atlas_def wall_atlas_def::deserialize(StringView filename) auto [dirs, dir_indexes, mask] = read_all_directions(jroot); fm_soft_assert(!dirs.isEmpty()); fm_soft_assert(dir_indexes != std::array<Wall::DirArrayIndex, Direction_COUNT>{}); - atlas.direction_array = std::move(dirs); + atlas.direction_array = move(dirs); atlas.direction_map = dir_indexes; atlas.direction_mask = mask; @@ -268,9 +268,9 @@ void write_all_frames(json& jroot, ArrayView<const Frame> array) for (const Frame& frame : array) { json jframe = frame; - jframes.push_back(std::move(jframe)); + jframes.push_back(move(jframe)); } - jroot["frames"] = std::move(jframes); + jroot["frames"] = move(jframes); } void write_group_metadata(json& jgroup, const Group& val) @@ -318,7 +318,7 @@ void write_all_directions(json& jroot, const wall_atlas& a) { auto jdir = json{}; write_direction_metadata(jdir, *dir); - jroot[name] = std::move(jdir); + jroot[name] = move(jdir); } } } diff --git a/shaders/lightmap.cpp b/shaders/lightmap.cpp index 004a4ace..14bb27e2 100644 --- a/shaders/lightmap.cpp +++ b/shaders/lightmap.cpp @@ -48,8 +48,8 @@ template<typename T, typename U> GL::Mesh make_light_mesh(T&& vert, U&& index) { GL::Mesh mesh{GL::MeshPrimitive::Triangles}; - mesh.addVertexBuffer(std::forward<T>(vert), 0, lightmap_shader::Position{}) - .setIndexBuffer(std::forward<U>(index), 0, GL::MeshIndexType::UnsignedShort) + mesh.addVertexBuffer(forward<T>(vert), 0, lightmap_shader::Position{}) + .setIndexBuffer(forward<U>(index), 0, GL::MeshIndexType::UnsignedShort) .setCount(6); return mesh; } @@ -149,8 +149,8 @@ quad& lightmap_shader::alloc_rect() occlusion_mesh = GL::Mesh{NoCreate}; vertex_buf = GL::Buffer{NoCreate}; index_buf = GL::Buffer{NoCreate}; - auto vertexes_ = std::move(vertexes); - auto indexes_ = std::move(indexes); + auto vertexes_ = move(vertexes); + auto indexes_ = move(indexes); vertexes = Array<std::array<Vector3, 4>>{ValueInit, capacity}; indexes = Array<std::array<UnsignedShort, 6>>{ValueInit, capacity}; for (auto i = 0uz; i < count; i++) diff --git a/shaders/shader.hpp b/shaders/shader.hpp index 56659218..41f876e1 100644 --- a/shaders/shader.hpp +++ b/shaders/shader.hpp @@ -78,7 +78,7 @@ template<typename T, typename... Xs> decltype(auto) tile_shader::draw(GL::AbstractTexture& tex, T&& mesh, Xs&&... xs) { draw_pre(tex); - decltype(auto) ret = GL::AbstractShaderProgram::draw(std::forward<T>(mesh), std::forward<Xs>(xs)...); + decltype(auto) ret = GL::AbstractShaderProgram::draw(forward<T>(mesh), forward<Xs>(xs)...); draw_post(tex); return ret; } diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index 353ebb34..b798ffcc 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -37,8 +37,8 @@ decltype(anim_atlas::_group_indices) anim_atlas::make_group_indices(const anim_d anim_atlas::anim_atlas() noexcept = default; anim_atlas::anim_atlas(String name, const ImageView2D& image, anim_def info) : - _name{std::move(name)}, _bitmask{make_bitmask(image)}, - _info{std::move(info)}, _group_indices{make_group_indices(_info)} + _name{move(name)}, _bitmask{make_bitmask(image)}, + _info{move(info)}, _group_indices{make_group_indices(_info)} { fm_soft_assert(!_info.groups.isEmpty()); diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp index efcacb88..a2e1032a 100644 --- a/src/chunk-render.cpp +++ b/src/chunk-render.cpp @@ -80,7 +80,7 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple mesh.addVertexBuffer(GL::Buffer{vertex_view}, 0, tile_shader::Position{}, tile_shader::TextureCoordinates{}, tile_shader::Depth{}) .setIndexBuffer(GL::Buffer{vert_index_view}, 0, GL::MeshIndexType::UnsignedShort) .setCount(int32_t(6 * count)); - ground_mesh = Utility::move(mesh); + ground_mesh = move(mesh); return { ground_mesh, _ground->indexes, count }; } diff --git a/src/chunk-scenery.cpp b/src/chunk-scenery.cpp index 2d950854..e32f13b9 100644 --- a/src/chunk-scenery.cpp +++ b/src/chunk-scenery.cpp @@ -178,7 +178,7 @@ auto chunk::ensure_scenery_mesh(scenery_scratch_buffers buffers) noexcept -> sce mesh.addVertexBuffer(GL::Buffer{vert_view}, 0, tile_shader::Position{}, tile_shader::TextureCoordinates{}, tile_shader::Depth{}) .setIndexBuffer(GL::Buffer{index_view}, 0, GL::MeshIndexType::UnsignedShort) .setCount(int32_t(6 * count)); - scenery_mesh = Utility::move(mesh); + scenery_mesh = move(mesh); } const auto size = _objects.size(); diff --git a/src/emplacer.hpp b/src/emplacer.hpp index d132bd7b..4a7f6bdb 100644 --- a/src/emplacer.hpp +++ b/src/emplacer.hpp @@ -1,6 +1,5 @@ #pragma once #include <type_traits> -#include <Corrade/Utility/Move.h> namespace floormat { @@ -10,7 +9,7 @@ class emplacer { using type = std::decay_t<decltype(std::declval<F>()())>; public: - explicit constexpr emplacer(F&& fun) noexcept : fun{Utility::forward<F>(fun)} {} + explicit constexpr emplacer(F&& fun) noexcept : fun{forward<F>(fun)} {} constexpr operator type() const noexcept { return fun(); } }; diff --git a/src/ground-atlas.cpp b/src/ground-atlas.cpp index d39ecadc..726ec557 100644 --- a/src/ground-atlas.cpp +++ b/src/ground-atlas.cpp @@ -14,7 +14,7 @@ namespace floormat { using namespace floormat::Quads; ground_atlas::ground_atlas(ground_def info, const ImageView2D& image) : - _def{std::move(info)}, _path{make_path(_def.name)}, + _def{move(info)}, _path{make_path(_def.name)}, _texcoords{make_texcoords_array(Vector2ui(image.size()), _def.size)}, _pixel_size{image.size()} { diff --git a/src/object.cpp b/src/object.cpp index 307a2155..550f8a6b 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -258,7 +258,7 @@ void object::move_to(size_t& i, Vector2i delta, rotation new_r) const_cast<rotation&>(r) = new_r; const_cast<class chunk*&>(c) = &c2; i = (size_t)std::distance(es.cbegin(), it); - arrayInsert(es, i, std::move(e_)); + arrayInsert(es, i, move(e_)); } } diff --git a/src/search-result.cpp b/src/search-result.cpp index 31f3887c..71cb9793 100644 --- a/src/search-result.cpp +++ b/src/search-result.cpp @@ -21,11 +21,11 @@ path_search_result::path_search_result() { if (_pool) { - auto ptr = std::move(_pool); + auto ptr = move(_pool); fm_debug_assert(ptr->vec.empty()); - auto next = std::move(ptr->_next); - _node = std::move(ptr); - _pool = std::move(next); + auto next = move(ptr->_next); + _node = move(ptr); + _pool = move(next); } else { @@ -39,8 +39,8 @@ path_search_result::~path_search_result() noexcept if (_node && _node->vec.capacity() > 0) [[likely]] { _node->vec.clear(); - _node->_next = std::move(_pool); - _pool = std::move(_node); + _node->_next = move(_pool); + _pool = move(_node); } } @@ -49,7 +49,7 @@ path_search_result::path_search_result(const path_search_result& x) noexcept fm_debug_assert(x._node); auto self = path_search_result{}; self._node->vec = x._node->vec; - _node = std::move(self._node); + _node = move(self._node); _cost = x._cost; } diff --git a/src/wall-atlas.cpp b/src/wall-atlas.cpp index 9ea81fe5..1d043db0 100644 --- a/src/wall-atlas.cpp +++ b/src/wall-atlas.cpp @@ -102,9 +102,9 @@ Vector2ui wall_atlas::expected_size(unsigned depth, Group_ group) } wall_atlas::wall_atlas(wall_atlas_def def, String path, const ImageView2D& img) - : _dir_array{std::move(def.direction_array)}, - _frame_array{std::move(def.frames)}, - _info{std::move(def.header)}, _path{std::move(path)}, + : _dir_array{move(def.direction_array)}, + _frame_array{move(def.frames)}, + _info{move(def.header)}, _path{move(path)}, _image_size{get_image_size(img)}, _direction_map{def.direction_map} { diff --git a/src/world.cpp b/src/world.cpp index a28db7d3..ef0de7ae 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -3,7 +3,7 @@ #include "object.hpp" #include "compat/int-hash.hpp" #include "compat/exception.hpp" -#include <Corrade/Containers/GrowableArray.h> +#include <cr/GrowableArray.h> #include <tsl/robin_map.h> using namespace floormat; @@ -32,7 +32,7 @@ world::world(std::unordered_map<chunk_coords_, chunk>&& chunks) : world{std::max(initial_capacity, size_t(1/max_load_factor * 2 * chunks.size()))} { for (auto&& [coord, c] : chunks) - operator[](coord) = std::move(c); + operator[](coord) = move(c); } world& world::operator=(world&& w) noexcept @@ -42,10 +42,10 @@ world& world::operator=(world&& w) noexcept fm_assert(!_teardown); fm_assert(w._unique_id); _last_chunk = {}; - _chunks = std::move(w._chunks); - _objects = std::move(w._objects); + _chunks = move(w._chunks); + _objects = move(w._objects); w._objects = {}; - _unique_id = std::move(w._unique_id); + _unique_id = move(w._unique_id); fm_debug_assert(_unique_id); fm_debug_assert(w._unique_id == nullptr); _object_counter = w._object_counter; diff --git a/src/world.hpp b/src/world.hpp index 8880fec0..19a31a46 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -6,7 +6,6 @@ #include "loader/policy.hpp" #include <memory> #include <unordered_map> -#include <Corrade/Utility/Move.h> namespace floormat { @@ -78,7 +77,7 @@ public: } std::shared_ptr<T> make_object(object_id id, global_coords pos, Xs&&... xs) { - auto ret = std::shared_ptr<T>(new T{id, operator[](pos.chunk3()), Utility::forward<Xs>(xs)...}); + auto ret = std::shared_ptr<T>(new T{id, operator[](pos.chunk3()), forward<Xs>(xs)...}); do_make_object(static_pointer_cast<object>(ret), pos, sorted); return ret; } @@ -86,7 +85,7 @@ public: template<typename T, typename... Xs> std::shared_ptr<object> make_unconnected_object(Xs&&... xs) { - return std::shared_ptr<T>(new T{0, operator[](chunk_coords_{}), {}, Utility::forward<Xs>(xs)...}); + return std::shared_ptr<T>(new T{0, operator[](chunk_coords_{}), {}, forward<Xs>(xs)...}); } template<typename T = object> std::shared_ptr<T> find_object(object_id id); @@ -120,7 +119,7 @@ std::shared_ptr<T> world::find_object(object_id id) { if (!(ptr->type() == object_type_<T>::value)) [[unlikely]] throw_on_wrong_object_type(id, ptr->type(), object_type_<T>::value); - return static_pointer_cast<T>(Utility::move(ptr)); + return static_pointer_cast<T>(move(ptr)); } } diff --git a/test/intrusive-ptr.cpp b/test/intrusive-ptr.cpp index c37d5b2b..aa221026 100644 --- a/test/intrusive-ptr.cpp +++ b/test/intrusive-ptr.cpp @@ -116,7 +116,6 @@ void test_copy() void test_move() { using myptr = local_iptr<Test1>; - using Utility::move; fm_assert_free(); s = {}; @@ -142,7 +141,6 @@ void test_move() constexpr bool test_cexpr() // todo { using myptr = local_iptr<Test2>; - using Utility::move; // construct auto foo1 = myptr{}; diff --git a/wall-tileset-tool/main.cpp b/wall-tileset-tool/main.cpp index 62e29e0d..e752e517 100644 --- a/wall-tileset-tool/main.cpp +++ b/wall-tileset-tool/main.cpp @@ -45,10 +45,10 @@ const Direction& get_direction(const wall_atlas_def& atlas, size_t i) template<typename Fmt, typename... Xs> auto asformat(Fmt&& fmt, Xs&&... args) { - auto result = fmt::format_to_n((char*)nullptr, 0, std::forward<Fmt>(fmt), std::forward<Xs>(args)...); + auto result = fmt::format_to_n((char*)nullptr, 0, forward<Fmt>(fmt), forward<Xs>(args)...); std::string ret; ret.resize(result.size); - auto result2 = fmt::format_to_n(ret.data(), ret.size(), std::forward<Fmt>(fmt), std::forward<Xs>(args)...); + auto result2 = fmt::format_to_n(ret.data(), ret.size(), forward<Fmt>(fmt), forward<Xs>(args)...); fm_assert(result2.size == result.size); return ret; } @@ -221,7 +221,6 @@ bool do_group(state st, size_t i, size_t j, Group& new_group) if ((Group_)j == Group_::top) { cv::rotate(mat, mat2, cv::ROTATE_90_COUNTERCLOCKWISE); - using std::swap; swap(mat, mat2); } @@ -250,7 +249,7 @@ bool do_group(state st, size_t i, size_t j, Group& new_group) } frames.push_back({ - .mat = std::move(buf), + .mat = move(buf), .size = {(unsigned)mat.cols, (unsigned)mat.rows}, }); } @@ -297,7 +296,7 @@ bool do_direction(state& st, size_t i) return false; } - arrayAppend(st.new_atlas.direction_array, std::move(dir)); + arrayAppend(st.new_atlas.direction_array, move(dir)); return true; } @@ -310,7 +309,7 @@ bool do_input_file(state& st) fm_assert(any_bit_of(st.old_atlas.direction_mask)); auto& atlas = st.new_atlas; - atlas.header = std::move(const_cast<wall_atlas_def&>(st.old_atlas).header); + atlas.header = move(const_cast<wall_atlas_def&>(st.old_atlas).header); fm_assert(!atlas.frames.size()); fm_assert(!any_bit_of(atlas.direction_mask)); @@ -378,7 +377,7 @@ argument_tuple parse_cmdline(int argc, const char* const* argv) noexcept fm_assert(opts.output_dir); fm_assert(opts.input_file); fm_assert(opts.input_dir); - return { .opts = std::move(opts), .args = std::move(args), .ok = true }; + return { .opts = move(opts), .args = move(args), .ok = true }; } return {}; |