sparse_set: respect -> sort_as (naming is hard, you know)
This commit is contained in:
@@ -645,7 +645,7 @@ public:
|
||||
*/
|
||||
void sort_as(const base_type &other) const {
|
||||
if(*this) {
|
||||
descriptor->group().respect(other);
|
||||
descriptor->group().sort_as(other);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1376,7 +1376,7 @@ public:
|
||||
template<typename To, typename From>
|
||||
void sort() {
|
||||
ENTT_ASSERT(!owned<To>(), "Cannot sort owned storage");
|
||||
assure<To>().respect(assure<From>());
|
||||
assure<To>().sort_as(assure<From>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -962,12 +962,12 @@ public:
|
||||
* sets by using one of them as a master and the other one as a slave.
|
||||
*
|
||||
* Iterating the sparse set with a couple of iterators returns elements in
|
||||
* the expected order after a call to `respect`. See `begin` and `end` for
|
||||
* the expected order after a call to `sort_as`. See `begin` and `end` for
|
||||
* more details.
|
||||
*
|
||||
* @param other The sparse sets that imposes the order of the entities.
|
||||
*/
|
||||
void respect(const basic_sparse_set &other) {
|
||||
void sort_as(const basic_sparse_set &other) {
|
||||
compact();
|
||||
|
||||
const auto to = other.end();
|
||||
|
||||
@@ -1254,7 +1254,7 @@ TEST(SparseSet, RespectDisjoint) {
|
||||
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.begin(), lhs.end()));
|
||||
|
||||
lhs.respect(rhs);
|
||||
lhs.sort_as(rhs);
|
||||
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.begin(), lhs.end()));
|
||||
}
|
||||
@@ -1272,7 +1272,7 @@ TEST(SparseSet, RespectOverlap) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.begin(), lhs.end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.begin(), rhs.end()));
|
||||
|
||||
lhs.respect(rhs);
|
||||
lhs.sort_as(rhs);
|
||||
|
||||
auto begin = lhs.begin();
|
||||
auto end = lhs.end();
|
||||
@@ -1296,7 +1296,7 @@ TEST(SparseSet, RespectOrdered) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.begin(), lhs.end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.begin(), rhs.end()));
|
||||
|
||||
rhs.respect(lhs);
|
||||
rhs.sort_as(lhs);
|
||||
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.begin(), rhs.end()));
|
||||
}
|
||||
@@ -1314,7 +1314,7 @@ TEST(SparseSet, RespectReverse) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.begin(), lhs.end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.begin(), rhs.end()));
|
||||
|
||||
rhs.respect(lhs);
|
||||
rhs.sort_as(lhs);
|
||||
|
||||
auto begin = rhs.begin();
|
||||
auto end = rhs.end();
|
||||
@@ -1341,7 +1341,7 @@ TEST(SparseSet, RespectUnordered) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.begin(), lhs.end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.begin(), rhs.end()));
|
||||
|
||||
rhs.respect(lhs);
|
||||
rhs.sort_as(lhs);
|
||||
|
||||
auto begin = rhs.begin();
|
||||
auto end = rhs.end();
|
||||
@@ -1370,7 +1370,7 @@ TEST(SparseSet, RespectInvalid) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.begin(), lhs.end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.begin(), rhs.end()));
|
||||
|
||||
rhs.respect(lhs);
|
||||
rhs.sort_as(lhs);
|
||||
|
||||
auto begin = rhs.begin();
|
||||
auto end = rhs.end();
|
||||
|
||||
@@ -1568,7 +1568,7 @@ TEST_F(Storage, RespectDisjoint) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.entt::sparse_set::begin(), lhs.entt::sparse_set::end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_values), std::rend(lhs_values), lhs.begin(), lhs.end()));
|
||||
|
||||
lhs.respect(rhs);
|
||||
lhs.sort_as(rhs);
|
||||
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_entities), std::rend(lhs_entities), lhs.entt::sparse_set::begin(), lhs.entt::sparse_set::end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(lhs_values), std::rend(lhs_values), lhs.begin(), lhs.end()));
|
||||
@@ -1592,7 +1592,7 @@ TEST_F(Storage, RespectOverlap) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.entt::sparse_set::begin(), rhs.entt::sparse_set::end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_values), std::rend(rhs_values), rhs.begin(), rhs.end()));
|
||||
|
||||
lhs.respect(rhs);
|
||||
lhs.sort_as(rhs);
|
||||
|
||||
auto begin = lhs.begin();
|
||||
auto end = lhs.end();
|
||||
@@ -1625,7 +1625,7 @@ TEST_F(Storage, RespectOrdered) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.entt::sparse_set::begin(), rhs.entt::sparse_set::end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_values), std::rend(rhs_values), rhs.begin(), rhs.end()));
|
||||
|
||||
rhs.respect(lhs);
|
||||
rhs.sort_as(lhs);
|
||||
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.entt::sparse_set::begin(), rhs.entt::sparse_set::end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_values), std::rend(rhs_values), rhs.begin(), rhs.end()));
|
||||
@@ -1649,7 +1649,7 @@ TEST_F(Storage, RespectReverse) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.entt::sparse_set::begin(), rhs.entt::sparse_set::end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_values), std::rend(rhs_values), rhs.begin(), rhs.end()));
|
||||
|
||||
rhs.respect(lhs);
|
||||
rhs.sort_as(lhs);
|
||||
|
||||
auto begin = rhs.begin();
|
||||
auto end = rhs.end();
|
||||
@@ -1688,7 +1688,7 @@ TEST_F(Storage, RespectUnordered) {
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_entities), std::rend(rhs_entities), rhs.entt::sparse_set::begin(), rhs.entt::sparse_set::end()));
|
||||
ASSERT_TRUE(std::equal(std::rbegin(rhs_values), std::rend(rhs_values), rhs.begin(), rhs.end()));
|
||||
|
||||
rhs.respect(lhs);
|
||||
rhs.sort_as(lhs);
|
||||
|
||||
auto begin = rhs.begin();
|
||||
auto end = rhs.end();
|
||||
|
||||
@@ -417,7 +417,7 @@ ENTT_DEBUG_TEST(StorageEntityDeathTest, SortAndRespect) {
|
||||
other.push(entt::entity{2});
|
||||
|
||||
ASSERT_DEATH(pool.sort([](auto...) { return true; }), "");
|
||||
ASSERT_DEATH(pool.respect(other), "");
|
||||
ASSERT_DEATH(pool.sort_as(other), "");
|
||||
}
|
||||
|
||||
TEST(StorageEntity, CustomAllocator) {
|
||||
|
||||
Reference in New Issue
Block a user