stl: std::move

This commit is contained in:
skypjack
2026-04-01 09:34:50 +02:00
parent 9aeffebc7b
commit b32ec7f656
31 changed files with 134 additions and 133 deletions
+8 -8
View File
@@ -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<value_type>(allocator, std::move(other.element))} {}
element{entt::make_obj_using_allocator<value_type>(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<iterator, bool> 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<typename Arg>
std::pair<iterator, bool> insert_or_assign(key_type &&key, Arg &&value) {
return insert_or_overwrite(std::move(key), stl::forward<Arg>(value));
return insert_or_overwrite(stl::move(key), stl::forward<Arg>(value));
}
/**
@@ -626,7 +626,7 @@ public:
/*! @copydoc try_emplace */
template<typename... Args>
std::pair<iterator, bool> try_emplace(key_type &&key, Args &&...args) {
return insert_or_do_nothing(std::move(key), stl::forward<Args>(args)...);
return insert_or_do_nothing(stl::move(key), stl::forward<Args>(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;
}
/**
+4 -4
View File
@@ -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<iterator, bool> insert(value_type &&value) {
return insert_or_do_nothing(std::move(value));
return insert_or_do_nothing(stl::move(value));
}
/**
+4 -4
View File
@@ -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<Container>(payload).size() * sizeof...(Container)) == (std::get<Container>(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<class Allocator>
basic_table(Container &&...container, const Allocator &allocator) noexcept
: payload{Container{std::move(container), allocator}...} {
: payload{Container{stl::move(container), allocator}...} {
ENTT_ASSERT((((std::get<Container>(payload).size() * sizeof...(Container)) == (std::get<Container>(payload).size() + ...)) && ...), "Unexpected container size");
}
@@ -207,7 +207,7 @@ public:
*/
template<class Allocator>
basic_table(basic_table &&other, const Allocator &allocator)
: payload{Container{std::move(std::get<Container>(other.payload)), allocator}...} {}
: payload{Container{stl::move(std::get<Container>(other.payload)), allocator}...} {}
/*! @brief Default destructor. */
~basic_table() = default;
+7 -7
View File
@@ -34,7 +34,7 @@ struct std_sort {
*/
template<typename Compare = std::less<>, 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>(args)..., std::move(first), std::move(last), std::move(compare));
std::sort(stl::forward<Args>(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<It>::difference_type;
stl::vector<value_type> aux(static_cast<std::size_t>(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<difference_type>(pos)] = std::move(*it);
out[static_cast<difference_type>(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);
}
}
}
+4 -4
View File
@@ -77,7 +77,7 @@ class basic_any: private internal::basic_any_storage<Len, Align> {
case transfer:
if constexpr(std::is_move_assignable_v<Type>) {
// NOLINTNEXTLINE(bugprone-casting-through-void)
*const_cast<Type *>(elem) = std::move(*static_cast<Type *>(const_cast<void *>(other)));
*const_cast<Type *>(elem) = stl::move(*static_cast<Type *>(const_cast<void *>(other)));
return other;
}
[[fallthrough]];
@@ -103,7 +103,7 @@ class basic_any: private internal::basic_any_storage<Len, Align> {
ENTT_ASSERT(value.mode == any_policy::embedded, "Unexpected policy");
if constexpr(in_situ_v<Type>) {
// NOLINTNEXTLINE(bugprone-casting-through-void, bugprone-multi-level-implicit-pointer-conversion)
return ::new(&static_cast<basic_any *>(const_cast<void *>(other))->buffer) Type{std::move(*const_cast<Type *>(elem))};
return ::new(&static_cast<basic_any *>(const_cast<void *>(other))->buffer) Type{stl::move(*const_cast<Type *>(elem))};
}
}
@@ -562,14 +562,14 @@ template<typename Type, std::size_t Len, std::size_t Align>
[[nodiscard]] std::remove_const_t<Type> any_cast(basic_any<Len, Align> &&data) noexcept {
if constexpr(std::is_copy_constructible_v<stl::remove_cvref_t<Type>>) {
if(auto *const instance = any_cast<std::remove_reference_t<Type>>(&data); instance) {
return static_cast<Type>(std::move(*instance));
return static_cast<Type>(stl::move(*instance));
}
return any_cast<Type>(data);
} else {
auto *const instance = any_cast<std::remove_reference_t<Type>>(&data);
ENTT_ASSERT(instance, "Invalid instance");
return static_cast<Type>(std::move(*instance));
return static_cast<Type>(stl::move(*instance));
}
}
+2 -2
View File
@@ -142,8 +142,8 @@ public:
*/
template<typename... Args, typename... Other>
constexpr compressed_pair(std::piecewise_construct_t, stl::tuple<Args...> args, stl::tuple<Other...> other) noexcept(std::is_nothrow_constructible_v<first_base, Args...> && std::is_nothrow_constructible_v<second_base, Other...>)
: first_base{std::move(args), std::index_sequence_for<Args...>{}},
second_base{std::move(other), std::index_sequence_for<Other...>{}} {}
: first_base{stl::move(args), std::index_sequence_for<Args...>{}},
second_base{stl::move(other), std::index_sequence_for<Other...>{}} {}
/*! @brief Default destructor. */
~compressed_pair() = default;
+3 -3
View File
@@ -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_type>)
: 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<iterator> && std::is_nothrow_move_constructible_v<sentinel>)
: first{std::move(from)},
last{std::move(to)} {}
: first{stl::move(from)},
last{stl::move(to)} {}
/**
* @brief Returns an iterator to the beginning.
+2 -2
View File
@@ -33,7 +33,7 @@ constexpr void propagate_on_container_copy_assignment([[maybe_unused]] Allocator
template<typename Allocator>
constexpr void propagate_on_container_move_assignment([[maybe_unused]] Allocator &lhs, [[maybe_unused]] Allocator &rhs) noexcept {
if constexpr(std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value) {
lhs = std::move(rhs);
lhs = stl::move(rhs);
}
}
@@ -162,7 +162,7 @@ struct uses_allocator_construction<std::pair<Type, Other>> {
template<typename First, typename Second>
static constexpr auto args(const auto &allocator, std::pair<First, Second> &&value) noexcept {
return uses_allocator_construction<type>::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<type>::args(allocator, std::piecewise_construct, stl::forward_as_tuple(stl::move(value.first)), stl::forward_as_tuple(stl::move(value.second)));
}
};
+1 -1
View File
@@ -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>)
: func{std::move(recursive)} {}
: func{stl::move(recursive)} {}
/**
* @brief Invokes a y-combinator and therefore its underlying function.
+7 -7
View File
@@ -51,7 +51,7 @@ public:
extended_group_iterator(iterator_type from, stl::tuple<Owned *..., Get *...> 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<typename Type, typename... Other, typename Compare, typename Sort = std_sort, typename... Args>
void sort(Compare compare, Sort algo = Sort{}, Args &&...args) {
sort<index_of<Type>, index_of<Other>...>(std::move(compare), std::move(algo), stl::forward<Args>(args)...);
sort<index_of<Type>, index_of<Other>...>(stl::move(compare), stl::move(algo), stl::forward<Args>(args)...);
}
/**
@@ -618,7 +618,7 @@ public:
if(*this) {
if constexpr(sizeof...(Index) == 0) {
static_assert(std::is_invocable_v<Compare, const entity_type, const entity_type>, "Invalid comparison function");
descriptor->handle().sort(std::move(compare), std::move(algo), stl::forward<Args>(args)...);
descriptor->handle().sort(stl::move(compare), stl::move(algo), stl::forward<Args>(args)...);
} else {
auto comp = [&compare, cpools = pools_for(std::index_sequence_for<Get...>{})](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>(args)...);
descriptor->handle().sort(stl::move(comp), stl::move(algo), stl::forward<Args>(args)...);
}
}
}
@@ -997,7 +997,7 @@ public:
*/
template<typename Type, typename... Other, typename Compare, typename Sort = std_sort, typename... Args>
void sort(Compare compare, Sort algo = Sort{}, Args &&...args) const {
sort<index_of<Type>, index_of<Other>...>(std::move(compare), std::move(algo), stl::forward<Args>(args)...);
sort<index_of<Type>, index_of<Other>...>(stl::move(compare), stl::move(algo), stl::forward<Args>(args)...);
}
/**
@@ -1019,7 +1019,7 @@ public:
if constexpr(sizeof...(Index) == 0) {
static_assert(std::is_invocable_v<Compare, const entity_type, const entity_type>, "Invalid comparison function");
storage<0>()->sort_n(descriptor->length(), std::move(compare), std::move(algo), stl::forward<Args>(args)...);
storage<0>()->sort_n(descriptor->length(), stl::move(compare), stl::move(algo), stl::forward<Args>(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>(args)...);
storage<0>()->sort_n(descriptor->length(), stl::move(comp), stl::move(algo), stl::forward<Args>(args)...);
}
auto cb = [this](auto *head, auto *...other) {
+13 -13
View File
@@ -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<underlying_type &&>(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<underlying_type &&>(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<underlying_type &&>(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<underlying_type &&>(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<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixin &on_construct(const id_type id = type_hash<Clazz>::value()) {
auto curr = owner_or_assert().template storage<Clazz>(id).on_construct().template connect<Candidate>(*this);
conn.push_back(std::move(curr));
conn.push_back(stl::move(curr));
return *this;
}
@@ -512,7 +512,7 @@ public:
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixin &on_update(const id_type id = type_hash<Clazz>::value()) {
auto curr = owner_or_assert().template storage<Clazz>(id).on_update().template connect<Candidate>(*this);
conn.push_back(std::move(curr));
conn.push_back(stl::move(curr));
return *this;
}
@@ -526,7 +526,7 @@ public:
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixin &on_destroy(const id_type id = type_hash<Clazz>::value()) {
auto curr = owner_or_assert().template storage<Clazz>(id).on_destroy().template connect<Candidate>(*this);
conn.push_back(std::move(curr));
conn.push_back(stl::move(curr));
return *this;
}
+7 -7
View File
@@ -196,9 +196,9 @@ public:
* @param to List of out-edges of the vertex.
*/
vertex(vertex_data data, stl::vector<std::size_t> from, stl::vector<std::size_t> 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<std::integral_constant<decltype(Candidate), Candidate>>()};
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<std::integral_constant<decltype(Candidate), Candidate>>()};
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<void>()};
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;
+9 -9
View File
@@ -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<stl::output_iterator<entity_type> 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<typename Type>
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<Type>().insert(std::move(first), std::move(last), value);
assure<Type>().insert(stl::move(first), stl::move(last), value);
}
/**
@@ -1130,10 +1130,10 @@ public:
auto &cpool = assure<Type>();
if constexpr(std::is_invocable_v<Compare, decltype(cpool.get({})), decltype(cpool.get({}))>) {
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>(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>(args)...);
} else {
cpool.sort(std::move(compare), std::move(algo), stl::forward<Args>(args)...);
cpool.sort(stl::move(compare), stl::move(algo), stl::forward<Args>(args)...);
}
}
+2 -2
View File
@@ -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;
+4 -4
View File
@@ -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<first_type, entity_type> && stl::is_same_v<second_type, entity_type>) {
other.emplace(map(pair.first), map(pair.second));
} else if constexpr(stl::is_same_v<first_type, entity_type>) {
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<second_type, entity_type>, "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));
}
}
}
+6 -6
View File
@@ -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<difference_type>(length), packed.rend(), std::move(compare), stl::forward<Args>(args)...);
algo(packed.rend() - static_cast<difference_type>(length), packed.rend(), stl::move(compare), stl::forward<Args>(args)...);
for(size_type pos{}; pos < length; ++pos) {
auto curr = pos;
@@ -1000,7 +1000,7 @@ public:
template<typename Compare, typename Sort = std_sort, typename... Args>
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>(args)...);
sort_n(len, stl::move(compare), stl::move(algo), stl::forward<Args>(args)...);
}
/**
+7 -7
View File
@@ -288,7 +288,7 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
void move_to(const std::size_t lhs, const std::size_t rhs) {
auto &elem = element_at(lhs);
allocator_type allocator{get_allocator()};
entt::uninitialized_construct_using_allocator(stl::to_address(assure_at_least(rhs)), allocator, std::move(elem));
entt::uninitialized_construct_using_allocator(stl::to_address(assure_at_least(rhs)), allocator, stl::move(elem));
alloc_traits::destroy(allocator, std::addressof(elem));
}
@@ -326,12 +326,12 @@ protected:
base_type::in_place_pop(*first);
alloc_traits::destroy(allocator, std::addressof(elem));
} else if constexpr(std::is_trivially_destructible_v<element_type>) {
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<base_type &&>(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<base_type &&>(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;
}
+1 -1
View File
@@ -622,7 +622,7 @@ public:
void each(Func func) const {
[this, &func]<auto... Index>(std::index_sequence<Index...> seq) {
if(const auto *view = base_type::handle(); view != nullptr) {
((view == base_type::pool_at(Index) ? each<Index>(std::move(func), seq) : void()), ...);
((view == base_type::pool_at(Index) ? each<Index>(stl::move(func), seq) : void()), ...);
}
}(std::index_sequence_for<Get...>{});
}
+2 -2
View File
@@ -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. */
+2 -2
View File
@@ -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. */
+1 -1
View File
@@ -147,7 +147,7 @@ public:
*/
template<std::derived_from<Service> Type, typename Deleter = std::default_delete<Type>>
static void reset(Type *elem, Deleter deleter = {}) {
service = std::shared_ptr<Service>{elem, std::move(deleter)};
service = std::shared_ptr<Service>{elem, stl::move(deleter)};
}
private:
+8 -8
View File
@@ -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<meta_func_node>(std::move(node));
member->next = std::make_unique<meta_func_node>(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<meta_type_node>(std::move(node))).first->second.get();
parent = meta_context::from(*ctx).bucket.emplace(node.info->hash(), std::make_unique<meta_type_node>(stl::move(node))).first->second.get();
parent->details = std::make_unique<meta_type_descriptor>();
} else {
parent = it->second.get();
+7 -7
View File
@@ -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 {
+2 -2
View File
@@ -234,7 +234,7 @@ public:
basic_process &then(Func func) {
const auto &allocator = next.second();
using process_type = internal::process_adaptor<delta_type, Func, allocator_type>;
return *(next.first() = std::allocate_shared<process_type>(allocator, allocator, std::move(func)));
return *(next.first() = std::allocate_shared<process_type>(allocator, allocator, stl::move(func)));
}
/**
@@ -298,7 +298,7 @@ struct process_adaptor: public basic_process<Delta, Allocator> {
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);
+4 -4
View File
@@ -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<delta_type, Func, allocator_type>;
return *handlers.first().emplace_back(std::allocate_shared<process_type>(allocator, allocator, std::move(func)));
return *handlers.first().emplace_back(std::allocate_shared<process_type>(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();
}
}
+1 -1
View File
@@ -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;
+4 -4
View File
@@ -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<typename Other>
requires (!std::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
resource(resource<Other> &&other) noexcept
: value{std::move(other.value)} {}
: value{stl::move(other.value)} {}
/*! @brief Default destructor. */
~resource() = default;
@@ -114,7 +114,7 @@ public:
template<typename Other>
requires (!std::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
resource &operator=(resource<Other> &&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);
}
/**
+2 -2
View File
@@ -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");
}
+3 -3
View File
@@ -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<typename Type>
void on(std::function<void(Type &, Derived &)> func) {
handlers.first().insert_or_assign(type_id<Type>().hash(), [func = std::move(func), this](void *value) {
handlers.first().insert_or_assign(type_id<Type>().hash(), [func = stl::move(func), this](void *value) {
func(*static_cast<Type *>(value), static_cast<Derived &>(*this));
});
}
+6 -6
View File
@@ -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<sigh<Ret(Args...), Allocator>> {
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<Candidate>();
signal_or_assert().calls.push_back(std::move(call));
signal_or_assert().calls.push_back(stl::move(call));
delegate<void(void *)> conn{};
conn.template connect<&release<Candidate>>();
@@ -447,7 +447,7 @@ public:
delegate_type call{};
call.template connect<Candidate>(value_or_instance);
signal_or_assert().calls.push_back(std::move(call));
signal_or_assert().calls.push_back(stl::move(call));
delegate<void(void *)> conn{};
conn.template connect<&release<Candidate, Type &>>(value_or_instance);
@@ -471,7 +471,7 @@ public:
delegate_type call{};
call.template connect<Candidate>(value_or_instance);
signal_or_assert().calls.push_back(std::move(call));
signal_or_assert().calls.push_back(stl::move(call));
delegate<void(void *)> conn{};
conn.template connect<&release<Candidate, Type *>>(value_or_instance);
+1
View File
@@ -9,6 +9,7 @@ namespace entt::stl {
using std::declval;
using std::exchange;
using std::forward;
using std::move;
} // namespace entt::stl
/*! @endcond */