storage: safe self-move to support standard containers (close #601)

This commit is contained in:
Michele Caini
2020-12-01 22:59:14 +01:00
parent 0b73082aa0
commit 9d687c25b3

View File

@@ -169,7 +169,8 @@ class basic_storage: public basic_sparse_set<Entity> {
}
void swap_and_pop(const std::size_t pos) final {
instances[pos] = std::move(instances.back());
auto other = std::move(instances.back());
instances[pos] = std::move(other);
instances.pop_back();
}
@@ -466,7 +467,7 @@ public:
/**
* @brief Sort all elements according to the given comparison function.
*
*
* @sa sort_n
*
* @tparam Compare Type of comparison function object.