|
|
@@ -8,9 +8,9 @@
|
|
|
|
|
|
struct empty_type {};
|
|
|
|
|
|
-struct stable_type {
|
|
|
+struct pointer_stable {
|
|
|
static constexpr auto in_place_delete = true;
|
|
|
- int value;
|
|
|
+ int value{};
|
|
|
};
|
|
|
|
|
|
TEST(SingleComponentView, Functionalities) {
|
|
|
@@ -420,15 +420,15 @@ TEST(SingleComponentView, FrontBack) {
|
|
|
TEST(SingleComponentView, DeductionGuide) {
|
|
|
entt::registry registry;
|
|
|
entt::storage_type_t<int> istorage;
|
|
|
- entt::storage_type_t<stable_type> sstorage;
|
|
|
+ entt::storage_type_t<pointer_stable> sstorage;
|
|
|
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>>, entt::exclude_t<>>, decltype(entt::basic_view{istorage})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>>, entt::exclude_t<>>, decltype(entt::basic_view{std::as_const(istorage)})>();
|
|
|
- testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<stable_type>>, entt::exclude_t<>>, decltype(entt::basic_view{sstorage})>();
|
|
|
+ testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<pointer_stable>>, entt::exclude_t<>>, decltype(entt::basic_view{sstorage})>();
|
|
|
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(istorage), std::make_tuple()})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(std::as_const(istorage))})>();
|
|
|
- testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<stable_type>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(sstorage)})>();
|
|
|
+ testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<pointer_stable>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(sstorage)})>();
|
|
|
}
|
|
|
|
|
|
TEST(SingleComponentView, IterableViewAlgorithmCompatibility) {
|
|
|
@@ -446,13 +446,13 @@ TEST(SingleComponentView, IterableViewAlgorithmCompatibility) {
|
|
|
|
|
|
TEST(SingleComponentView, StableType) {
|
|
|
entt::registry registry;
|
|
|
- auto view = registry.view<stable_type>();
|
|
|
+ auto view = registry.view<pointer_stable>();
|
|
|
|
|
|
const auto entity = registry.create();
|
|
|
const auto other = registry.create();
|
|
|
|
|
|
- registry.emplace<stable_type>(entity);
|
|
|
- registry.emplace<stable_type>(other);
|
|
|
+ registry.emplace<pointer_stable>(entity);
|
|
|
+ registry.emplace<pointer_stable>(other);
|
|
|
registry.destroy(entity);
|
|
|
|
|
|
ASSERT_EQ(view.size_hint(), 2u);
|
|
|
@@ -465,18 +465,18 @@ TEST(SingleComponentView, StableType) {
|
|
|
ASSERT_EQ(*view.begin(), other);
|
|
|
ASSERT_EQ(++view.begin(), view.end());
|
|
|
|
|
|
- view.each([other](const auto entt, stable_type) {
|
|
|
+ view.each([other](const auto entt, pointer_stable) {
|
|
|
ASSERT_EQ(other, entt);
|
|
|
});
|
|
|
|
|
|
- view.each([check = true](stable_type) mutable {
|
|
|
+ view.each([check = true](pointer_stable) mutable {
|
|
|
ASSERT_TRUE(check);
|
|
|
check = false;
|
|
|
});
|
|
|
|
|
|
for(auto [entt, st]: view.each()) {
|
|
|
testing::StaticAssertTypeEq<decltype(entt), entt::entity>();
|
|
|
- testing::StaticAssertTypeEq<decltype(st), stable_type &>();
|
|
|
+ testing::StaticAssertTypeEq<decltype(st), pointer_stable &>();
|
|
|
ASSERT_EQ(other, entt);
|
|
|
}
|
|
|
|
|
|
@@ -1256,25 +1256,25 @@ TEST(MultiComponentView, DeductionGuide) {
|
|
|
entt::registry registry;
|
|
|
entt::storage_type_t<int> istorage;
|
|
|
entt::storage_type_t<double> dstorage;
|
|
|
- entt::storage_type_t<stable_type> sstorage;
|
|
|
+ entt::storage_type_t<pointer_stable> sstorage;
|
|
|
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{istorage, dstorage})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>, entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{std::as_const(istorage), dstorage})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, const entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{istorage, std::as_const(dstorage)})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>, const entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{std::as_const(istorage), std::as_const(dstorage)})>();
|
|
|
- testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, entt::storage_type_t<stable_type>>, entt::exclude_t<>>, decltype(entt::basic_view{istorage, sstorage})>();
|
|
|
+ testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, entt::storage_type_t<pointer_stable>>, entt::exclude_t<>>, decltype(entt::basic_view{istorage, sstorage})>();
|
|
|
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(istorage, dstorage), std::make_tuple()})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>, entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(std::as_const(istorage), dstorage)})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, const entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(istorage, std::as_const(dstorage))})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>, const entt::storage_type_t<double>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(std::as_const(istorage), std::as_const(dstorage))})>();
|
|
|
- testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, entt::storage_type_t<stable_type>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(istorage, sstorage)})>();
|
|
|
+ testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, entt::storage_type_t<pointer_stable>>, entt::exclude_t<>>, decltype(entt::basic_view{std::forward_as_tuple(istorage, sstorage)})>();
|
|
|
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>>, entt::exclude_t<entt::storage_type_t<double>>>, decltype(entt::basic_view{std::forward_as_tuple(istorage), std::forward_as_tuple(dstorage)})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>>, entt::exclude_t<entt::storage_type_t<double>>>, decltype(entt::basic_view{std::forward_as_tuple(std::as_const(istorage)), std::forward_as_tuple(dstorage)})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>>, entt::exclude_t<const entt::storage_type_t<double>>>, decltype(entt::basic_view{std::forward_as_tuple(istorage), std::forward_as_tuple(std::as_const(dstorage))})>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<int>>, entt::exclude_t<const entt::storage_type_t<double>>>, decltype(entt::basic_view{std::forward_as_tuple(std::as_const(istorage)), std::forward_as_tuple(std::as_const(dstorage))})>();
|
|
|
- testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>>, entt::exclude_t<entt::storage_type_t<stable_type>>>, decltype(entt::basic_view{std::forward_as_tuple(istorage), std::forward_as_tuple(sstorage)})>();
|
|
|
+ testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>>, entt::exclude_t<entt::storage_type_t<pointer_stable>>>, decltype(entt::basic_view{std::forward_as_tuple(istorage), std::forward_as_tuple(sstorage)})>();
|
|
|
}
|
|
|
|
|
|
TEST(MultiComponentView, IterableViewAlgorithmCompatibility) {
|
|
|
@@ -1293,20 +1293,20 @@ TEST(MultiComponentView, IterableViewAlgorithmCompatibility) {
|
|
|
|
|
|
TEST(MultiComponentView, StableType) {
|
|
|
entt::registry registry;
|
|
|
- auto view = registry.view<int, stable_type>();
|
|
|
+ auto view = registry.view<int, pointer_stable>();
|
|
|
|
|
|
const auto entity = registry.create();
|
|
|
const auto other = registry.create();
|
|
|
|
|
|
registry.emplace<int>(entity);
|
|
|
registry.emplace<int>(other);
|
|
|
- registry.emplace<stable_type>(entity);
|
|
|
- registry.emplace<stable_type>(other);
|
|
|
+ registry.emplace<pointer_stable>(entity);
|
|
|
+ registry.emplace<pointer_stable>(other);
|
|
|
registry.destroy(entity);
|
|
|
|
|
|
ASSERT_EQ(view.size_hint(), 1u);
|
|
|
|
|
|
- view.use<stable_type>();
|
|
|
+ view.use<pointer_stable>();
|
|
|
|
|
|
ASSERT_EQ(view.size_hint(), 2u);
|
|
|
ASSERT_FALSE(view.contains(entity));
|
|
|
@@ -1318,11 +1318,11 @@ TEST(MultiComponentView, StableType) {
|
|
|
ASSERT_EQ(*view.begin(), other);
|
|
|
ASSERT_EQ(++view.begin(), view.end());
|
|
|
|
|
|
- view.each([other](const auto entt, int, stable_type) {
|
|
|
+ view.each([other](const auto entt, int, pointer_stable) {
|
|
|
ASSERT_EQ(other, entt);
|
|
|
});
|
|
|
|
|
|
- view.each([check = true](int, stable_type) mutable {
|
|
|
+ view.each([check = true](int, pointer_stable) mutable {
|
|
|
ASSERT_TRUE(check);
|
|
|
check = false;
|
|
|
});
|
|
|
@@ -1330,7 +1330,7 @@ TEST(MultiComponentView, StableType) {
|
|
|
for(auto [entt, iv, st]: view.each()) {
|
|
|
testing::StaticAssertTypeEq<decltype(entt), entt::entity>();
|
|
|
testing::StaticAssertTypeEq<decltype(iv), int &>();
|
|
|
- testing::StaticAssertTypeEq<decltype(st), stable_type &>();
|
|
|
+ testing::StaticAssertTypeEq<decltype(st), pointer_stable &>();
|
|
|
ASSERT_EQ(other, entt);
|
|
|
}
|
|
|
|
|
|
@@ -1341,13 +1341,13 @@ TEST(MultiComponentView, StableType) {
|
|
|
|
|
|
TEST(MultiComponentView, StableTypeWithExcludedComponent) {
|
|
|
entt::registry registry;
|
|
|
- auto view = registry.view<stable_type>(entt::exclude<int>);
|
|
|
+ auto view = registry.view<pointer_stable>(entt::exclude<int>);
|
|
|
|
|
|
const auto entity = registry.create();
|
|
|
const auto other = registry.create();
|
|
|
|
|
|
- registry.emplace<stable_type>(entity, 0);
|
|
|
- registry.emplace<stable_type>(other, 42);
|
|
|
+ registry.emplace<pointer_stable>(entity, 0);
|
|
|
+ registry.emplace<pointer_stable>(other, 42);
|
|
|
registry.emplace<int>(entity);
|
|
|
|
|
|
ASSERT_EQ(view.size_hint(), 2u);
|
|
|
@@ -1629,12 +1629,12 @@ TEST(View, Pipe) {
|
|
|
|
|
|
registry.emplace<int>(other);
|
|
|
registry.emplace<char>(other);
|
|
|
- registry.emplace<stable_type>(other);
|
|
|
+ registry.emplace<pointer_stable>(other);
|
|
|
|
|
|
auto view1 = registry.view<int>(entt::exclude<const double>);
|
|
|
auto view2 = registry.view<const char>(entt::exclude<float>);
|
|
|
auto view3 = registry.view<empty_type>();
|
|
|
- auto view4 = registry.view<stable_type>();
|
|
|
+ auto view4 = registry.view<pointer_stable>();
|
|
|
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<entt::storage_type_t<int>, const entt::storage_type_t<char>>, entt::exclude_t<const entt::storage_type_t<double>, entt::storage_type_t<float>>>, decltype(view1 | view2)>();
|
|
|
testing::StaticAssertTypeEq<entt::basic_view<entt::get_t<const entt::storage_type_t<char>, entt::storage_type_t<int>>, entt::exclude_t<entt::storage_type_t<float>, const entt::storage_type_t<double>>>, decltype(view2 | view1)>();
|
|
|
@@ -1668,7 +1668,7 @@ TEST(View, Pipe) {
|
|
|
|
|
|
ASSERT_EQ(pack14.storage<int>(), nullptr);
|
|
|
ASSERT_EQ(pack14.storage<const double>(), nullptr);
|
|
|
- ASSERT_NE(pack14.storage<stable_type>(), nullptr);
|
|
|
+ ASSERT_NE(pack14.storage<pointer_stable>(), nullptr);
|
|
|
|
|
|
ASSERT_EQ(pack32.storage<empty_type>(), nullptr);
|
|
|
ASSERT_NE(pack32.storage<const char>(), nullptr);
|