From b32ec7f656eb7793fcb09d76b75aca414e850376 Mon Sep 17 00:00:00 2001 From: skypjack Date: Wed, 1 Apr 2026 09:34:50 +0200 Subject: [PATCH] stl: std::move --- src/entt/container/dense_map.hpp | 16 ++++++++-------- src/entt/container/dense_set.hpp | 8 ++++---- src/entt/container/table.hpp | 8 ++++---- src/entt/core/algorithm.hpp | 14 +++++++------- src/entt/core/any.hpp | 8 ++++---- src/entt/core/compressed_pair.hpp | 4 ++-- src/entt/core/iterator.hpp | 6 +++--- src/entt/core/memory.hpp | 4 ++-- src/entt/core/utility.hpp | 2 +- src/entt/entity/group.hpp | 14 +++++++------- src/entt/entity/mixin.hpp | 26 +++++++++++++------------- src/entt/entity/organizer.hpp | 14 +++++++------- src/entt/entity/registry.hpp | 18 +++++++++--------- src/entt/entity/runtime_view.hpp | 4 ++-- src/entt/entity/snapshot.hpp | 8 ++++---- src/entt/entity/sparse_set.hpp | 12 ++++++------ src/entt/entity/storage.hpp | 14 +++++++------- src/entt/entity/view.hpp | 2 +- src/entt/graph/adjacency_matrix.hpp | 4 ++-- src/entt/graph/flow.hpp | 4 ++-- src/entt/locator/locator.hpp | 2 +- src/entt/meta/factory.hpp | 16 ++++++++-------- src/entt/meta/meta.hpp | 14 +++++++------- src/entt/process/process.hpp | 4 ++-- src/entt/process/scheduler.hpp | 8 ++++---- src/entt/resource/cache.hpp | 2 +- src/entt/resource/resource.hpp | 8 ++++---- src/entt/signal/dispatcher.hpp | 4 ++-- src/entt/signal/emitter.hpp | 6 +++--- src/entt/signal/sigh.hpp | 12 ++++++------ src/entt/stl/utility.hpp | 1 + 31 files changed, 134 insertions(+), 133 deletions(-) diff --git a/src/entt/container/dense_map.hpp b/src/entt/container/dense_map.hpp index 19bf626a6..e3a5ed42e 100644 --- a/src/entt/container/dense_map.hpp +++ b/src/entt/container/dense_map.hpp @@ -49,7 +49,7 @@ struct dense_map_node final { dense_map_node(std::allocator_arg_t, const auto &allocator, dense_map_node &&other) : next{other.next}, - element{entt::make_obj_using_allocator(allocator, std::move(other.element))} {} + element{entt::make_obj_using_allocator(allocator, stl::move(other.element))} {} std::size_t next; value_type element; @@ -298,7 +298,7 @@ class dense_map { void move_and_pop(const std::size_t pos) { if(const auto last = size() - 1u; pos != last) { size_type *curr = &sparse.first()[key_to_bucket(packed.first().back().element.first)]; - packed.first()[pos] = std::move(packed.first().back()); + packed.first()[pos] = stl::move(packed.first().back()); for(; *curr != last; curr = &packed.first()[*curr].next) {} *curr = pos; } @@ -404,8 +404,8 @@ public: * @param allocator The allocator to use. */ dense_map(dense_map &&other, const allocator_type &allocator) - : sparse{std::piecewise_construct, stl::forward_as_tuple(std::move(other.sparse.first()), allocator), stl::forward_as_tuple(std::move(other.sparse.second()))}, - packed{std::piecewise_construct, stl::forward_as_tuple(std::move(other.packed.first()), allocator), stl::forward_as_tuple(std::move(other.packed.second()))}, + : sparse{std::piecewise_construct, stl::forward_as_tuple(stl::move(other.sparse.first()), allocator), stl::forward_as_tuple(stl::move(other.sparse.second()))}, + packed{std::piecewise_construct, stl::forward_as_tuple(stl::move(other.packed.first()), allocator), stl::forward_as_tuple(stl::move(other.packed.second()))}, threshold{other.threshold} {} /*! @brief Default destructor. */ @@ -526,7 +526,7 @@ public: /*! @copydoc insert */ std::pair insert(value_type &&value) { - return insert_or_do_nothing(std::move(value.first), std::move(value.second)); + return insert_or_do_nothing(stl::move(value.first), stl::move(value.second)); } /** @@ -567,7 +567,7 @@ public: /*! @copydoc insert_or_assign */ template std::pair insert_or_assign(key_type &&key, Arg &&value) { - return insert_or_overwrite(std::move(key), stl::forward(value)); + return insert_or_overwrite(stl::move(key), stl::forward(value)); } /** @@ -626,7 +626,7 @@ public: /*! @copydoc try_emplace */ template std::pair try_emplace(key_type &&key, Args &&...args) { - return insert_or_do_nothing(std::move(key), stl::forward(args)...); + return insert_or_do_nothing(stl::move(key), stl::forward(args)...); } /** @@ -727,7 +727,7 @@ public: * @return A reference to the mapped value of the requested element. */ [[nodiscard]] mapped_type &operator[](key_type &&key) { - return insert_or_do_nothing(std::move(key)).first->second; + return insert_or_do_nothing(stl::move(key)).first->second; } /** diff --git a/src/entt/container/dense_set.hpp b/src/entt/container/dense_set.hpp index 1d4cebec3..48844fcf6 100644 --- a/src/entt/container/dense_set.hpp +++ b/src/entt/container/dense_set.hpp @@ -245,7 +245,7 @@ class dense_set { void move_and_pop(const std::size_t pos) { if(const auto last = size() - 1u; pos != last) { size_type *curr = &sparse.first()[value_to_bucket(packed.first().back().second)]; - packed.first()[pos] = std::move(packed.first().back()); + packed.first()[pos] = stl::move(packed.first().back()); for(; *curr != last; curr = &packed.first()[*curr].first) {} *curr = pos; } @@ -353,8 +353,8 @@ public: * @param allocator The allocator to use. */ dense_set(dense_set &&other, const allocator_type &allocator) - : sparse{std::piecewise_construct, stl::forward_as_tuple(std::move(other.sparse.first()), allocator), stl::forward_as_tuple(std::move(other.sparse.second()))}, - packed{std::piecewise_construct, stl::forward_as_tuple(std::move(other.packed.first()), allocator), stl::forward_as_tuple(std::move(other.packed.second()))}, + : sparse{std::piecewise_construct, stl::forward_as_tuple(stl::move(other.sparse.first()), allocator), stl::forward_as_tuple(stl::move(other.sparse.second()))}, + packed{std::piecewise_construct, stl::forward_as_tuple(stl::move(other.packed.first()), allocator), stl::forward_as_tuple(stl::move(other.packed.second()))}, threshold{other.threshold} {} /*! @brief Default destructor. */ @@ -515,7 +515,7 @@ public: /*! @copydoc insert */ std::pair insert(value_type &&value) { - return insert_or_do_nothing(std::move(value)); + return insert_or_do_nothing(stl::move(value)); } /** diff --git a/src/entt/container/table.hpp b/src/entt/container/table.hpp index a1fa7cc30..4c9cfde38 100644 --- a/src/entt/container/table.hpp +++ b/src/entt/container/table.hpp @@ -154,7 +154,7 @@ public: * @param container The containers to move from. */ explicit basic_table(Container &&...container) noexcept - : payload{std::move(container)...} { + : payload{stl::move(container)...} { ENTT_ASSERT((((std::get(payload).size() * sizeof...(Container)) == (std::get(payload).size() + ...)) && ...), "Unexpected container size"); } @@ -166,7 +166,7 @@ public: * @param other The instance to move from. */ basic_table(basic_table &&other) noexcept - : payload{std::move(other.payload)} {} + : payload{stl::move(other.payload)} {} /** * @brief Constructs the underlying containers using a given allocator. @@ -195,7 +195,7 @@ public: */ template basic_table(Container &&...container, const Allocator &allocator) noexcept - : payload{Container{std::move(container), allocator}...} { + : payload{Container{stl::move(container), allocator}...} { ENTT_ASSERT((((std::get(payload).size() * sizeof...(Container)) == (std::get(payload).size() + ...)) && ...), "Unexpected container size"); } @@ -207,7 +207,7 @@ public: */ template basic_table(basic_table &&other, const Allocator &allocator) - : payload{Container{std::move(std::get(other.payload)), allocator}...} {} + : payload{Container{stl::move(std::get(other.payload)), allocator}...} {} /*! @brief Default destructor. */ ~basic_table() = default; diff --git a/src/entt/core/algorithm.hpp b/src/entt/core/algorithm.hpp index d36b6fe22..233f5e4ca 100644 --- a/src/entt/core/algorithm.hpp +++ b/src/entt/core/algorithm.hpp @@ -34,7 +34,7 @@ struct std_sort { */ template, typename... Args> void operator()(stl::random_access_iterator auto first, stl::random_access_iterator auto last, Compare compare = Compare{}, Args &&...args) const { - std::sort(stl::forward(args)..., std::move(first), std::move(last), std::move(compare)); + std::sort(stl::forward(args)..., stl::move(first), stl::move(last), stl::move(compare)); } }; @@ -54,16 +54,16 @@ struct insertion_sort { void operator()(stl::random_access_iterator auto first, stl::random_access_iterator auto last, Compare compare = Compare{}) const { if(first < last) { for(auto it = first + 1; it < last; ++it) { - auto value = std::move(*it); + auto value = stl::move(*it); auto pre = it; // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) for(; pre > first && compare(value, *(pre - 1)); --pre) { - *pre = std::move(*(pre - 1)); + *pre = stl::move(*(pre - 1)); } // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic) - *pre = std::move(value); + *pre = stl::move(value); } } } @@ -101,7 +101,7 @@ struct radix_sort { using difference_type = stl::iterator_traits::difference_type; stl::vector aux(static_cast(stl::distance(first, last))); - auto part = [getter = std::move(getter)](auto from, auto to, auto out, auto start) { + auto part = [getter = stl::move(getter)](auto from, auto to, auto out, auto start) { constexpr auto mask = (1 << Bit) - 1; constexpr auto buckets = 1 << Bit; @@ -121,7 +121,7 @@ struct radix_sort { for(auto it = from; it != to; ++it) { const auto pos = index[(getter(*it) >> start) & mask]++; - out[static_cast(pos)] = std::move(*it); + out[static_cast(pos)] = stl::move(*it); } }; @@ -132,7 +132,7 @@ struct radix_sort { if constexpr(passes & 1) { part(first, last, aux.begin(), (passes - 1) * Bit); - std::move(aux.begin(), aux.end(), first); + stl::move(aux.begin(), aux.end(), first); } } } diff --git a/src/entt/core/any.hpp b/src/entt/core/any.hpp index 73953e3c3..d90fc8cba 100644 --- a/src/entt/core/any.hpp +++ b/src/entt/core/any.hpp @@ -77,7 +77,7 @@ class basic_any: private internal::basic_any_storage { case transfer: if constexpr(std::is_move_assignable_v) { // NOLINTNEXTLINE(bugprone-casting-through-void) - *const_cast(elem) = std::move(*static_cast(const_cast(other))); + *const_cast(elem) = stl::move(*static_cast(const_cast(other))); return other; } [[fallthrough]]; @@ -103,7 +103,7 @@ class basic_any: private internal::basic_any_storage { ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy"); if constexpr(in_situ_v) { // NOLINTNEXTLINE(bugprone-casting-through-void, bugprone-multi-level-implicit-pointer-conversion) - return ::new(&static_cast(const_cast(other))->buffer) Type{std::move(*const_cast(elem))}; + return ::new(&static_cast(const_cast(other))->buffer) Type{stl::move(*const_cast(elem))}; } } @@ -562,14 +562,14 @@ template [[nodiscard]] std::remove_const_t any_cast(basic_any &&data) noexcept { if constexpr(std::is_copy_constructible_v>) { if(auto *const instance = any_cast>(&data); instance) { - return static_cast(std::move(*instance)); + return static_cast(stl::move(*instance)); } return any_cast(data); } else { auto *const instance = any_cast>(&data); ENTT_ASSERT(instance, "Invalid instance"); - return static_cast(std::move(*instance)); + return static_cast(stl::move(*instance)); } } diff --git a/src/entt/core/compressed_pair.hpp b/src/entt/core/compressed_pair.hpp index 013b47f25..c5e7a04ae 100644 --- a/src/entt/core/compressed_pair.hpp +++ b/src/entt/core/compressed_pair.hpp @@ -142,8 +142,8 @@ public: */ template constexpr compressed_pair(std::piecewise_construct_t, stl::tuple args, stl::tuple other) noexcept(std::is_nothrow_constructible_v && std::is_nothrow_constructible_v) - : first_base{std::move(args), std::index_sequence_for{}}, - second_base{std::move(other), std::index_sequence_for{}} {} + : first_base{stl::move(args), std::index_sequence_for{}}, + second_base{stl::move(other), std::index_sequence_for{}} {} /*! @brief Default destructor. */ ~compressed_pair() = default; diff --git a/src/entt/core/iterator.hpp b/src/entt/core/iterator.hpp index 8939299a1..4429abd74 100644 --- a/src/entt/core/iterator.hpp +++ b/src/entt/core/iterator.hpp @@ -27,7 +27,7 @@ struct input_iterator_pointer final { * @param val Value to use to initialize the proxy object. */ constexpr input_iterator_pointer(value_type &&val) noexcept(std::is_nothrow_move_constructible_v) - : value{std::move(val)} {} + : value{stl::move(val)} {} /** * @brief Access operator for accessing wrapped values. @@ -140,8 +140,8 @@ struct iterable_adaptor final { * @param to End iterator. */ constexpr iterable_adaptor(iterator from, sentinel to) noexcept(std::is_nothrow_move_constructible_v && std::is_nothrow_move_constructible_v) - : first{std::move(from)}, - last{std::move(to)} {} + : first{stl::move(from)}, + last{stl::move(to)} {} /** * @brief Returns an iterator to the beginning. diff --git a/src/entt/core/memory.hpp b/src/entt/core/memory.hpp index 097939274..fe1684315 100644 --- a/src/entt/core/memory.hpp +++ b/src/entt/core/memory.hpp @@ -33,7 +33,7 @@ constexpr void propagate_on_container_copy_assignment([[maybe_unused]] Allocator template constexpr void propagate_on_container_move_assignment([[maybe_unused]] Allocator &lhs, [[maybe_unused]] Allocator &rhs) noexcept { if constexpr(std::allocator_traits::propagate_on_container_move_assignment::value) { - lhs = std::move(rhs); + lhs = stl::move(rhs); } } @@ -162,7 +162,7 @@ struct uses_allocator_construction> { template static constexpr auto args(const auto &allocator, std::pair &&value) noexcept { - return uses_allocator_construction::args(allocator, std::piecewise_construct, stl::forward_as_tuple(std::move(value.first)), stl::forward_as_tuple(std::move(value.second))); + return uses_allocator_construction::args(allocator, std::piecewise_construct, stl::forward_as_tuple(stl::move(value.first)), stl::forward_as_tuple(stl::move(value.second))); } }; diff --git a/src/entt/core/utility.hpp b/src/entt/core/utility.hpp index 679eced21..b90d4503e 100644 --- a/src/entt/core/utility.hpp +++ b/src/entt/core/utility.hpp @@ -56,7 +56,7 @@ struct y_combinator { * @param recursive A potentially recursive function. */ constexpr y_combinator(Func recursive) noexcept(std::is_nothrow_move_constructible_v) - : func{std::move(recursive)} {} + : func{stl::move(recursive)} {} /** * @brief Invokes a y-combinator and therefore its underlying function. diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index be06f649f..a4822d88c 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -51,7 +51,7 @@ public: extended_group_iterator(iterator_type from, stl::tuple cpools) : it{from}, - pools{std::move(cpools)} {} + pools{stl::move(cpools)} {} extended_group_iterator &operator++() noexcept { return ++it, *this; @@ -597,7 +597,7 @@ public: */ template void sort(Compare compare, Sort algo = Sort{}, Args &&...args) { - sort, index_of...>(std::move(compare), std::move(algo), stl::forward(args)...); + sort, index_of...>(stl::move(compare), stl::move(algo), stl::forward(args)...); } /** @@ -618,7 +618,7 @@ public: if(*this) { if constexpr(sizeof...(Index) == 0) { static_assert(std::is_invocable_v, "Invalid comparison function"); - descriptor->handle().sort(std::move(compare), std::move(algo), stl::forward(args)...); + descriptor->handle().sort(stl::move(compare), stl::move(algo), stl::forward(args)...); } else { auto comp = [&compare, cpools = pools_for(std::index_sequence_for{})](const entity_type lhs, const entity_type rhs) { if constexpr(sizeof...(Index) == 1) { @@ -628,7 +628,7 @@ public: } }; - descriptor->handle().sort(std::move(comp), std::move(algo), stl::forward(args)...); + descriptor->handle().sort(stl::move(comp), stl::move(algo), stl::forward(args)...); } } } @@ -997,7 +997,7 @@ public: */ template void sort(Compare compare, Sort algo = Sort{}, Args &&...args) const { - sort, index_of...>(std::move(compare), std::move(algo), stl::forward(args)...); + sort, index_of...>(stl::move(compare), stl::move(algo), stl::forward(args)...); } /** @@ -1019,7 +1019,7 @@ public: if constexpr(sizeof...(Index) == 0) { static_assert(std::is_invocable_v, "Invalid comparison function"); - storage<0>()->sort_n(descriptor->length(), std::move(compare), std::move(algo), stl::forward(args)...); + storage<0>()->sort_n(descriptor->length(), stl::move(compare), stl::move(algo), stl::forward(args)...); } else { auto comp = [&compare, &cpools](const entity_type lhs, const entity_type rhs) { if constexpr(sizeof...(Index) == 1) { @@ -1029,7 +1029,7 @@ public: } }; - storage<0>()->sort_n(descriptor->length(), std::move(comp), std::move(algo), stl::forward(args)...); + storage<0>()->sort_n(descriptor->length(), stl::move(comp), stl::move(algo), stl::forward(args)...); } auto cb = [this](auto *head, auto *...other) { diff --git a/src/entt/entity/mixin.hpp b/src/entt/entity/mixin.hpp index 83d816038..106ce87f7 100644 --- a/src/entt/entity/mixin.hpp +++ b/src/entt/entity/mixin.hpp @@ -127,7 +127,7 @@ private: } } - underlying_type::bind_any(std::move(value)); + underlying_type::bind_any(stl::move(value)); } public: @@ -175,9 +175,9 @@ public: basic_sigh_mixin(basic_sigh_mixin &&other) noexcept : underlying_type{static_cast(other)}, owner{other.owner}, - construction{std::move(other.construction)}, - destruction{std::move(other.destruction)}, - update{std::move(other.update)} {} + construction{stl::move(other.construction)}, + destruction{stl::move(other.destruction)}, + update{stl::move(other.update)} {} /** * @brief Allocator-extended move constructor. @@ -187,9 +187,9 @@ public: basic_sigh_mixin(basic_sigh_mixin &&other, const allocator_type &allocator) : underlying_type{static_cast(other), allocator}, owner{other.owner}, - construction{std::move(other.construction), allocator}, - destruction{std::move(other.destruction), allocator}, - update{std::move(other.update), allocator} {} + construction{stl::move(other.construction), allocator}, + destruction{stl::move(other.destruction), allocator}, + update{stl::move(other.update), allocator} {} /*! @brief Default destructor. */ ~basic_sigh_mixin() override = default; @@ -420,7 +420,7 @@ private: } } - underlying_type::bind_any(std::move(value)); + underlying_type::bind_any(stl::move(value)); } public: @@ -455,7 +455,7 @@ public: basic_reactive_mixin(basic_reactive_mixin &&other) noexcept : underlying_type{static_cast(other)}, owner{other.owner}, - conn{std::move(other.conn)} { + conn{stl::move(other.conn)} { } /** @@ -466,7 +466,7 @@ public: basic_reactive_mixin(basic_reactive_mixin &&other, const allocator_type &allocator) : underlying_type{static_cast(other), allocator}, owner{other.owner}, - conn{std::move(other.conn), allocator} { + conn{stl::move(other.conn), allocator} { } /*! @brief Default destructor. */ @@ -498,7 +498,7 @@ public: template basic_reactive_mixin &on_construct(const id_type id = type_hash::value()) { auto curr = owner_or_assert().template storage(id).on_construct().template connect(*this); - conn.push_back(std::move(curr)); + conn.push_back(stl::move(curr)); return *this; } @@ -512,7 +512,7 @@ public: template basic_reactive_mixin &on_update(const id_type id = type_hash::value()) { auto curr = owner_or_assert().template storage(id).on_update().template connect(*this); - conn.push_back(std::move(curr)); + conn.push_back(stl::move(curr)); return *this; } @@ -526,7 +526,7 @@ public: template basic_reactive_mixin &on_destroy(const id_type id = type_hash::value()) { auto curr = owner_or_assert().template storage(id).on_destroy().template connect(*this); - conn.push_back(std::move(curr)); + conn.push_back(stl::move(curr)); return *this; } diff --git a/src/entt/entity/organizer.hpp b/src/entt/entity/organizer.hpp index 8aca429a6..ede040983 100644 --- a/src/entt/entity/organizer.hpp +++ b/src/entt/entity/organizer.hpp @@ -196,9 +196,9 @@ public: * @param to List of out-edges of the vertex. */ vertex(vertex_data data, stl::vector from, stl::vector to) - : node{std::move(data)}, - in{std::move(from)}, - out{std::move(to)} {} + : node{stl::move(data)}, + in{stl::move(from)}, + out{stl::move(to)} {} /** * @brief Fills a buffer with the type info objects for the writable @@ -334,7 +334,7 @@ public: &type_id>()}; track_dependencies(vertices.size(), resource_type::sync_point, typename resource_type::ro{}, typename resource_type::rw{}); - vertices.push_back(std::move(vdata)); + vertices.push_back(stl::move(vdata)); } /** @@ -366,7 +366,7 @@ public: &type_id>()}; track_dependencies(vertices.size(), resource_type::sync_point, typename resource_type::ro{}, typename resource_type::rw{}); - vertices.push_back(std::move(vdata)); + vertices.push_back(stl::move(vdata)); } /** @@ -392,7 +392,7 @@ public: nullptr, &type_id()}; - vertices.push_back(std::move(vdata)); + vertices.push_back(stl::move(vdata)); } /** @@ -415,7 +415,7 @@ public: out.push_back(edge.second); } - adjacency_list.emplace_back(vertices[curr], std::move(in), std::move(out)); + adjacency_list.emplace_back(vertices[curr], stl::move(in), stl::move(out)); } return adjacency_list; diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index b23b6e8df..1d9b85fd7 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -320,10 +320,10 @@ public: * @param other The instance to move from. */ basic_registry(basic_registry &&other) noexcept - : vars{std::move(other.vars)}, - pools{std::move(other.pools)}, - groups{std::move(other.groups)}, - entities{std::move(other.entities)} { + : vars{stl::move(other.vars)}, + pools{stl::move(other.pools)}, + groups{stl::move(other.groups)}, + entities{stl::move(other.entities)} { rebind(); } @@ -489,7 +489,7 @@ public: */ template It> void create(It first, It last) { - entities.generate(std::move(first), std::move(last)); + entities.generate(stl::move(first), stl::move(last)); } /** @@ -582,7 +582,7 @@ public: template void insert(stl::input_iterator auto first, stl::input_iterator auto last, const Type &value = {}) { ENTT_ASSERT(std::all_of(first, last, [this](const auto entt) { return valid(entt); }), "Invalid entity"); - assure().insert(std::move(first), std::move(last), value); + assure().insert(stl::move(first), stl::move(last), value); } /** @@ -1130,10 +1130,10 @@ public: auto &cpool = assure(); if constexpr(std::is_invocable_v) { - auto comp = [&cpool, compare = std::move(compare)](const auto lhs, const auto rhs) { return compare(std::as_const(cpool.get(lhs)), std::as_const(cpool.get(rhs))); }; - cpool.sort(std::move(comp), std::move(algo), stl::forward(args)...); + auto comp = [&cpool, compare = stl::move(compare)](const auto lhs, const auto rhs) { return compare(std::as_const(cpool.get(lhs)), std::as_const(cpool.get(rhs))); }; + cpool.sort(stl::move(comp), stl::move(algo), stl::forward(args)...); } else { - cpool.sort(std::move(compare), std::move(algo), stl::forward(args)...); + cpool.sort(stl::move(compare), stl::move(algo), stl::forward(args)...); } } diff --git a/src/entt/entity/runtime_view.hpp b/src/entt/entity/runtime_view.hpp index c0b4db600..3b1bf3919 100644 --- a/src/entt/entity/runtime_view.hpp +++ b/src/entt/entity/runtime_view.hpp @@ -174,8 +174,8 @@ public: * @param allocator The allocator to use. */ basic_runtime_view(basic_runtime_view &&other, const allocator_type &allocator) - : pools{std::move(other.pools), allocator}, - filter{std::move(other.filter), allocator} {} + : pools{stl::move(other.pools), allocator}, + filter{stl::move(other.filter), allocator} {} /*! @brief Default destructor. */ ~basic_runtime_view() = default; diff --git a/src/entt/entity/snapshot.hpp b/src/entt/entity/snapshot.hpp index 04e43a223..4a9bf936c 100644 --- a/src/entt/entity/snapshot.hpp +++ b/src/entt/entity/snapshot.hpp @@ -255,7 +255,7 @@ public: } else { Type elem{}; archive(elem); - storage.emplace(entity, std::move(elem)); + storage.emplace(entity, stl::move(elem)); } } } @@ -326,10 +326,10 @@ class basic_continuous_loader { if constexpr(stl::is_same_v && stl::is_same_v) { other.emplace(map(pair.first), map(pair.second)); } else if constexpr(stl::is_same_v) { - other.emplace(map(pair.first), std::move(pair.second)); + other.emplace(map(pair.first), stl::move(pair.second)); } else { static_assert(stl::is_same_v, "Neither the key nor the value are of entity type"); - other.emplace(std::move(pair.first), map(pair.second)); + other.emplace(stl::move(pair.first), map(pair.second)); } } @@ -452,7 +452,7 @@ public: } else { Type elem{}; archive(elem); - storage.emplace(map(entt), std::move(elem)); + storage.emplace(map(entt), stl::move(elem)); } } } diff --git a/src/entt/entity/sparse_set.hpp b/src/entt/entity/sparse_set.hpp index f5bf37d96..e082894fe 100644 --- a/src/entt/entity/sparse_set.hpp +++ b/src/entt/entity/sparse_set.hpp @@ -418,8 +418,8 @@ public: * @param other The instance to move from. */ basic_sparse_set(basic_sparse_set &&other) noexcept - : sparse{std::move(other.sparse)}, - packed{std::move(other.packed)}, + : sparse{stl::move(other.sparse)}, + packed{stl::move(other.packed)}, descriptor{other.descriptor}, mode{other.mode}, head{stl::exchange(other.head, policy_to_head())} {} @@ -430,8 +430,8 @@ public: * @param allocator The allocator to use. */ basic_sparse_set(basic_sparse_set &&other, const allocator_type &allocator) - : sparse{std::move(other.sparse), allocator}, - packed{std::move(other.packed), allocator}, + : sparse{stl::move(other.sparse), allocator}, + packed{stl::move(other.packed), allocator}, descriptor{other.descriptor}, mode{other.mode}, head{stl::exchange(other.head, policy_to_head())} { @@ -967,7 +967,7 @@ public: ENTT_ASSERT((mode != deletion_policy::in_place) || (head == max_size), "Sorting with tombstones not allowed"); ENTT_ASSERT(!(length > packed.size()), "Length exceeds the number of elements"); - algo(packed.rend() - static_cast(length), packed.rend(), std::move(compare), stl::forward(args)...); + algo(packed.rend() - static_cast(length), packed.rend(), stl::move(compare), stl::forward(args)...); for(size_type pos{}; pos < length; ++pos) { auto curr = pos; @@ -1000,7 +1000,7 @@ public: template void sort(Compare compare, Sort algo = Sort{}, Args &&...args) { const size_type len = (mode == deletion_policy::swap_only) ? head : packed.size(); - sort_n(len, std::move(compare), std::move(algo), stl::forward(args)...); + sort_n(len, stl::move(compare), stl::move(algo), stl::forward(args)...); } /** diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index 499eb9c74..e794c047a 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -288,7 +288,7 @@ class basic_storage: public basic_sparse_set) { - elem = std::move(element_at(base_type::size() - 1u)); + elem = stl::move(element_at(base_type::size() - 1u)); base_type::swap_and_pop(*first); } else { auto &other = element_at(base_type::size() - 1u); // destroying on exit allows reentrant destructors - [[maybe_unused]] auto unused = stl::exchange(elem, std::move(other)); + [[maybe_unused]] auto unused = stl::exchange(elem, stl::move(other)); alloc_traits::destroy(allocator, std::addressof(other)); base_type::swap_and_pop(*first); } @@ -441,7 +441,7 @@ public: */ basic_storage(basic_storage &&other) noexcept : base_type{static_cast(other)}, - payload{std::move(other.payload)} {} + payload{stl::move(other.payload)} {} /** * @brief Allocator-extended move constructor. @@ -450,7 +450,7 @@ public: */ basic_storage(basic_storage &&other, const allocator_type &allocator) : base_type{static_cast(other), allocator}, - payload{std::move(other.payload), allocator} { + payload{stl::move(other.payload), allocator} { ENTT_ASSERT(alloc_traits::is_always_equal::value || get_allocator() == other.get_allocator(), "Copying a storage is not allowed"); } @@ -832,7 +832,7 @@ public: * @param allocator The allocator to use. */ basic_storage(basic_storage &&other, const allocator_type &allocator) - : base_type{std::move(other), allocator} {} + : base_type{stl::move(other), allocator} {} /*! @brief Default destructor. */ ~basic_storage() override = default; @@ -1072,7 +1072,7 @@ public: */ basic_storage &operator=(basic_storage &&other) noexcept { placeholder = other.placeholder; - base_type::operator=(std::move(other)); + base_type::operator=(stl::move(other)); return *this; } diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index 8b0668663..4d7607995 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -622,7 +622,7 @@ public: void each(Func func) const { [this, &func](std::index_sequence seq) { if(const auto *view = base_type::handle(); view != nullptr) { - ((view == base_type::pool_at(Index) ? each(std::move(func), seq) : void()), ...); + ((view == base_type::pool_at(Index) ? each(stl::move(func), seq) : void()), ...); } }(std::index_sequence_for{}); } diff --git a/src/entt/graph/adjacency_matrix.hpp b/src/entt/graph/adjacency_matrix.hpp index 3e47a3682..dffee9513 100644 --- a/src/entt/graph/adjacency_matrix.hpp +++ b/src/entt/graph/adjacency_matrix.hpp @@ -37,7 +37,7 @@ public: // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) constexpr edge_iterator(It base, const size_type vertices, const size_type from, const size_type to, const size_type step) noexcept - : it{std::move(base)}, + : it{stl::move(base)}, vert{vertices}, pos{from}, last{to}, @@ -153,7 +153,7 @@ public: * @param allocator The allocator to use. */ adjacency_matrix(adjacency_matrix &&other, const allocator_type &allocator) - : matrix{std::move(other.matrix), allocator}, + : matrix{stl::move(other.matrix), allocator}, vert{other.vert} {} /*! @brief Default destructor. */ diff --git a/src/entt/graph/flow.hpp b/src/entt/graph/flow.hpp index d39e5a201..4ce218d61 100644 --- a/src/entt/graph/flow.hpp +++ b/src/entt/graph/flow.hpp @@ -162,8 +162,8 @@ public: */ basic_flow(basic_flow &&other, const allocator_type &allocator) : index{other.index.first(), allocator}, - vertices{std::move(other.vertices), allocator}, - deps{std::move(other.deps), allocator}, + vertices{stl::move(other.vertices), allocator}, + deps{stl::move(other.deps), allocator}, sync_on{other.sync_on} {} /*! @brief Default destructor. */ diff --git a/src/entt/locator/locator.hpp b/src/entt/locator/locator.hpp index 214e5c496..a8e14601e 100644 --- a/src/entt/locator/locator.hpp +++ b/src/entt/locator/locator.hpp @@ -147,7 +147,7 @@ public: */ template Type, typename Deleter = std::default_delete> static void reset(Type *elem, Deleter deleter = {}) { - service = std::shared_ptr{elem, std::move(deleter)}; + service = std::shared_ptr{elem, stl::move(deleter)}; } private: diff --git a/src/entt/meta/factory.hpp b/src/entt/meta/factory.hpp index b4bac223c..c7be0d081 100644 --- a/src/entt/meta/factory.hpp +++ b/src/entt/meta/factory.hpp @@ -81,9 +81,9 @@ protected: bucket = node.id; if(auto *member = find_member(parent->details->data, node.id); member == nullptr) { - parent->details->data.emplace_back(std::move(node)); + parent->details->data.emplace_back(stl::move(node)); } else if(member->set != node.set || member->get != node.get) { - *member = std::move(node); + *member = stl::move(node); } } @@ -93,10 +93,10 @@ protected: invoke = node.invoke; if(auto *member = find_member(parent->details->func, node.id); member == nullptr) { - parent->details->func.emplace_back(std::move(node)); + parent->details->func.emplace_back(stl::move(node)); } else if(auto *overload = find_overload(member, node.invoke); overload == nullptr) { while(member->next != nullptr) { member = member->next.get(); } - member->next = std::make_unique(std::move(node)); + member->next = std::make_unique(stl::move(node)); } } @@ -121,13 +121,13 @@ protected: void custom(meta_custom_node node) { switch(state) { case mode::type: - parent->custom = std::move(node); + parent->custom = stl::move(node); break; case mode::data: - find_member_or_assert()->custom = std::move(node); + find_member_or_assert()->custom = stl::move(node); break; case mode::func: - find_overload_or_assert()->custom = std::move(node); + find_overload_or_assert()->custom = stl::move(node); break; } } @@ -138,7 +138,7 @@ public: bucket{node.info->hash()}, state{mode::type} { if(const auto it = meta_context::from(*ctx).bucket.find(bucket); it == meta_context::from(*ctx).bucket.cend()) { - parent = meta_context::from(*ctx).bucket.emplace(node.info->hash(), std::make_unique(std::move(node))).first->second.get(); + parent = meta_context::from(*ctx).bucket.emplace(node.info->hash(), std::make_unique(stl::move(node))).first->second.get(); parent->details = std::make_unique(); } else { parent = it->second.get(); diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index 0190adeaa..1e75fd0d9 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -225,7 +225,7 @@ class meta_any { } meta_any(const meta_any &other, any elem) - : storage{std::move(elem)}, + : storage{stl::move(elem)}, ctx{other.ctx}, node{other.node}, vtable{other.vtable} {} @@ -324,7 +324,7 @@ public: * @param other The instance to move from. */ meta_any(const meta_ctx &area, meta_any &&other) - : storage{std::move(other.storage)}, + : storage{stl::move(other.storage)}, ctx{&area}, node{(ctx == other.ctx) ? stl::exchange(other.node, nullptr) : nullptr}, vtable{stl::exchange(other.vtable, nullptr)} {} @@ -345,7 +345,7 @@ public: * @param other The instance to move from. */ meta_any(meta_any &&other) noexcept - : storage{std::move(other.storage)}, + : storage{stl::move(other.storage)}, ctx{other.ctx}, node{stl::exchange(other.node, nullptr)}, vtable{stl::exchange(other.vtable, nullptr)} {} @@ -375,7 +375,7 @@ public: * @return This meta any object. */ meta_any &operator=(meta_any &&other) noexcept { - storage = std::move(other.storage); + storage = stl::move(other.storage); ctx = other.ctx; node = stl::exchange(other.node, nullptr); vtable = stl::exchange(other.vtable, nullptr); @@ -728,7 +728,7 @@ public: * @param other The instance to move from. */ meta_handle(const meta_ctx &area, meta_handle &&other) - : any{area, std::move(other.any)} {} + : any{area, stl::move(other.any)} {} /*! @brief Default copy constructor, deleted on purpose. */ meta_handle(const meta_handle &) = delete; @@ -1425,7 +1425,7 @@ public: if(const auto &ref = fetch_node(); ref.details) { if(auto *elem = internal::find_member(ref.details->func, id); elem != nullptr) { if(const auto *candidate = lookup(args, sz, (wrapped->base().policy() == any_policy::cref), [curr = elem]() mutable { return (curr != nullptr) ? stl::exchange(curr, curr->next.get()) : nullptr; }); candidate) { - return candidate->invoke(std::move(wrapped), args); + return candidate->invoke(stl::move(wrapped), args); } } } @@ -1590,7 +1590,7 @@ inline bool meta_any::assign(const meta_any &other) { } inline bool meta_any::assign(meta_any &&other) { - return storage.assign(std::move(other.storage)) || storage.assign(std::as_const(other).allow_cast(type()).storage); + return storage.assign(stl::move(other.storage)) || storage.assign(std::as_const(other).allow_cast(type()).storage); } [[nodiscard]] inline meta_type meta_data::type() const noexcept { diff --git a/src/entt/process/process.hpp b/src/entt/process/process.hpp index d76647012..02144d969 100644 --- a/src/entt/process/process.hpp +++ b/src/entt/process/process.hpp @@ -234,7 +234,7 @@ public: basic_process &then(Func func) { const auto &allocator = next.second(); using process_type = internal::process_adaptor; - return *(next.first() = std::allocate_shared(allocator, allocator, std::move(func))); + return *(next.first() = std::allocate_shared(allocator, allocator, stl::move(func))); } /** @@ -298,7 +298,7 @@ struct process_adaptor: public basic_process { process_adaptor(const allocator_type &allocator, Func proc) : base_type{allocator}, - func{std::move(proc)} {} + func{stl::move(proc)} {} void update(const delta_type delta, void *data) override { func(*this, delta, data); diff --git a/src/entt/process/scheduler.hpp b/src/entt/process/scheduler.hpp index a2f423c0b..998749050 100644 --- a/src/entt/process/scheduler.hpp +++ b/src/entt/process/scheduler.hpp @@ -68,7 +68,7 @@ public: * @param other The instance to move from. */ basic_scheduler(basic_scheduler &&other) noexcept - : handlers{std::move(other.handlers)} {} + : handlers{stl::move(other.handlers)} {} /** * @brief Allocator-extended move constructor. @@ -76,7 +76,7 @@ public: * @param allocator The allocator to use. */ basic_scheduler(basic_scheduler &&other, const allocator_type &allocator) - : handlers{container_type{std::move(other.handlers.first()), allocator}, allocator} { + : handlers{container_type{stl::move(other.handlers.first()), allocator}, allocator} { ENTT_ASSERT(alloc_traits::is_always_equal::value || get_allocator() == other.get_allocator(), "Copying a scheduler is not allowed"); } @@ -166,7 +166,7 @@ public: type &attach(Func func) { const auto &allocator = handlers.second(); using process_type = internal::process_adaptor; - return *handlers.first().emplace_back(std::allocate_shared(allocator, allocator, std::move(func))); + return *handlers.first().emplace_back(std::allocate_shared(allocator, allocator, stl::move(func))); } /** @@ -192,7 +192,7 @@ public: } if(!elem || elem->rejected()) { - elem = std::move(handlers.first().back()); + elem = stl::move(handlers.first().back()); handlers.first().pop_back(); } } diff --git a/src/entt/resource/cache.hpp b/src/entt/resource/cache.hpp index beec713ba..22b2d996b 100644 --- a/src/entt/resource/cache.hpp +++ b/src/entt/resource/cache.hpp @@ -183,7 +183,7 @@ public: * @param allocator The allocator to use. */ resource_cache(resource_cache &&other, const allocator_type &allocator) - : pool{std::piecewise_construct, stl::forward_as_tuple(std::move(other.pool.first()), allocator), stl::forward_as_tuple(std::move(other.pool.second()))} {} + : pool{std::piecewise_construct, stl::forward_as_tuple(stl::move(other.pool.first()), allocator), stl::forward_as_tuple(stl::move(other.pool.second()))} {} /*! @brief Default destructor. */ ~resource_cache() = default; diff --git a/src/entt/resource/resource.hpp b/src/entt/resource/resource.hpp index afa6162d5..9c5c6ffb3 100644 --- a/src/entt/resource/resource.hpp +++ b/src/entt/resource/resource.hpp @@ -39,7 +39,7 @@ public: * @param res A handle to a resource. */ explicit resource(handle_type res) noexcept - : value{std::move(res)} {} + : value{stl::move(res)} {} /*! @brief Default copy constructor. */ resource(const resource &) noexcept = default; @@ -75,7 +75,7 @@ public: template requires (!std::same_as && std::constructible_from) resource(resource &&other) noexcept - : value{std::move(other.value)} {} + : value{stl::move(other.value)} {} /*! @brief Default destructor. */ ~resource() = default; @@ -114,7 +114,7 @@ public: template requires (!std::same_as && std::constructible_from) resource &operator=(resource &&other) noexcept { - value = std::move(other.value); + value = stl::move(other.value); return *this; } @@ -192,7 +192,7 @@ public: * @param other A handle to a resource. */ void reset(handle_type other) { - value = std::move(other); + value = stl::move(other); } /** diff --git a/src/entt/signal/dispatcher.hpp b/src/entt/signal/dispatcher.hpp index b8a95fa38..413e21df6 100644 --- a/src/entt/signal/dispatcher.hpp +++ b/src/entt/signal/dispatcher.hpp @@ -161,7 +161,7 @@ public: * @param other The instance to move from. */ basic_dispatcher(basic_dispatcher &&other) noexcept - : pools{std::move(other.pools)} {} + : pools{stl::move(other.pools)} {} /** * @brief Allocator-extended move constructor. @@ -169,7 +169,7 @@ public: * @param allocator The allocator to use. */ basic_dispatcher(basic_dispatcher &&other, const allocator_type &allocator) - : pools{container_type{std::move(other.pools.first()), allocator}, allocator} { + : pools{container_type{stl::move(other.pools.first()), allocator}, allocator} { ENTT_ASSERT(alloc_traits::is_always_equal::value || get_allocator() == other.get_allocator(), "Copying a dispatcher is not allowed"); } diff --git a/src/entt/signal/emitter.hpp b/src/entt/signal/emitter.hpp index 8c2e802b4..889ce3276 100644 --- a/src/entt/signal/emitter.hpp +++ b/src/entt/signal/emitter.hpp @@ -66,7 +66,7 @@ public: * @param other The instance to move from. */ emitter(emitter &&other) noexcept - : handlers{std::move(other.handlers)} {} + : handlers{stl::move(other.handlers)} {} /** * @brief Allocator-extended move constructor. @@ -74,7 +74,7 @@ public: * @param allocator The allocator to use. */ emitter(emitter &&other, const allocator_type &allocator) - : handlers{container_type{std::move(other.handlers.first()), allocator}, allocator} { + : handlers{container_type{stl::move(other.handlers.first()), allocator}, allocator} { ENTT_ASSERT(alloc_traits::is_always_equal::value || handlers.second() == other.handlers.second(), "Copying an emitter is not allowed"); } @@ -136,7 +136,7 @@ public: */ template void on(std::function func) { - handlers.first().insert_or_assign(type_id().hash(), [func = std::move(func), this](void *value) { + handlers.first().insert_or_assign(type_id().hash(), [func = stl::move(func), this](void *value) { func(*static_cast(value), static_cast(*this)); }); } diff --git a/src/entt/signal/sigh.hpp b/src/entt/signal/sigh.hpp index 3dc025161..be44cac58 100644 --- a/src/entt/signal/sigh.hpp +++ b/src/entt/signal/sigh.hpp @@ -97,7 +97,7 @@ public: * @param other The instance to move from. */ sigh(sigh &&other) noexcept - : calls{std::move(other.calls)} {} + : calls{stl::move(other.calls)} {} /** * @brief Allocator-extended move constructor. @@ -105,7 +105,7 @@ public: * @param allocator The allocator to use. */ sigh(sigh &&other, const allocator_type &allocator) - : calls{std::move(other.calls), allocator} {} + : calls{stl::move(other.calls), allocator} {} /*! @brief Default destructor. */ ~sigh() = default; @@ -376,7 +376,7 @@ class sink> { for(auto pos = ref.calls.size(); pos; --pos) { if(auto &elem = ref.calls[pos - 1u]; callback(elem)) { - elem = std::move(ref.calls.back()); + elem = stl::move(ref.calls.back()); ref.calls.pop_back(); } } @@ -418,7 +418,7 @@ public: delegate_type call{}; call.template connect(); - signal_or_assert().calls.push_back(std::move(call)); + signal_or_assert().calls.push_back(stl::move(call)); delegate conn{}; conn.template connect<&release>(); @@ -447,7 +447,7 @@ public: delegate_type call{}; call.template connect(value_or_instance); - signal_or_assert().calls.push_back(std::move(call)); + signal_or_assert().calls.push_back(stl::move(call)); delegate conn{}; conn.template connect<&release>(value_or_instance); @@ -471,7 +471,7 @@ public: delegate_type call{}; call.template connect(value_or_instance); - signal_or_assert().calls.push_back(std::move(call)); + signal_or_assert().calls.push_back(stl::move(call)); delegate conn{}; conn.template connect<&release>(value_or_instance); diff --git a/src/entt/stl/utility.hpp b/src/entt/stl/utility.hpp index 2cfae4928..36b508a36 100644 --- a/src/entt/stl/utility.hpp +++ b/src/entt/stl/utility.hpp @@ -9,6 +9,7 @@ namespace entt::stl { using std::declval; using std::exchange; using std::forward; +using std::move; } // namespace entt::stl /*! @endcond */