doc/test: minor changes
This commit is contained in:
@@ -125,19 +125,19 @@ class basic_group<Entity, exclude_t<Exclude...>, get_t<Get...>> final {
|
||||
using reverse_iterator = iterable_group_iterator<typename basic_sparse_set<Entity>::reverse_iterator>;
|
||||
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
return iterator{group.begin(), group};
|
||||
return { group.begin(), group };
|
||||
}
|
||||
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
return iterator{group.end(), group};
|
||||
return { group.end(), group };
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{group.rbegin(), group};
|
||||
return { group.rbegin(), group };
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{group.rend(), group};
|
||||
return { group.rend(), group };
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -276,10 +276,6 @@ public:
|
||||
* The returned iterator points to the first entity of the group. If the
|
||||
* group is empty, the returned iterator will be equal to `end()`.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the first entity of the group.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
@@ -293,10 +289,6 @@ public:
|
||||
* the group. Attempting to dereference the returned iterator results in
|
||||
* undefined behavior.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* group.
|
||||
*/
|
||||
@@ -310,10 +302,6 @@ public:
|
||||
* The returned iterator points to the first entity of the reversed group.
|
||||
* If the group is empty, the returned iterator will be equal to `rend()`.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the first entity of the reversed group.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
@@ -328,10 +316,6 @@ public:
|
||||
* the reversed group. Attempting to dereference the returned iterator
|
||||
* results in undefined behavior.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* reversed group.
|
||||
*/
|
||||
@@ -674,28 +658,28 @@ class basic_group<Entity, exclude_t<Exclude...>, get_t<Get...>, Owned...> final
|
||||
>;
|
||||
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
return iterator{
|
||||
return {
|
||||
std::get<0>(pools)->basic_sparse_set<Entity>::end() - *length,
|
||||
std::make_tuple((std::get<pool_type<Owned> *>(pools)->end() - *length)..., std::get<pool_type<Get> *>(pools)...)
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
return iterator{
|
||||
return {
|
||||
std::get<0>(pools)->basic_sparse_set<Entity>::end(),
|
||||
std::make_tuple((std::get<pool_type<Owned> *>(pools)->end())..., std::get<pool_type<Get> *>(pools)...)
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{
|
||||
return {
|
||||
std::get<0>(pools)->basic_sparse_set<Entity>::rbegin(),
|
||||
std::make_tuple((std::get<pool_type<Owned> *>(pools)->rbegin())..., std::get<pool_type<Get> *>(pools)...)
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{
|
||||
return {
|
||||
std::get<0>(pools)->basic_sparse_set<Entity>::rbegin() + *length,
|
||||
std::make_tuple((std::get<pool_type<Owned> *>(pools)->rbegin() + *length)..., std::get<pool_type<Get> *>(pools)...)
|
||||
};
|
||||
@@ -836,10 +820,6 @@ public:
|
||||
* The returned iterator points to the first entity of the group. If the
|
||||
* group is empty, the returned iterator will be equal to `end()`.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the first entity of the group.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
@@ -853,10 +833,6 @@ public:
|
||||
* the group. Attempting to dereference the returned iterator results in
|
||||
* undefined behavior.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* group.
|
||||
*/
|
||||
@@ -870,10 +846,6 @@ public:
|
||||
* The returned iterator points to the first entity of the reversed group.
|
||||
* If the group is empty, the returned iterator will be equal to `rend()`.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the first entity of the reversed group.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
@@ -888,10 +860,6 @@ public:
|
||||
* the reversed group. Attempting to dereference the returned iterator
|
||||
* results in undefined behavior.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* reversed group.
|
||||
*/
|
||||
|
||||
@@ -177,10 +177,6 @@ public:
|
||||
* components. If the view is empty, the returned iterator will be equal to
|
||||
* `end()`.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the first entity that has the given components.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const {
|
||||
@@ -195,10 +191,6 @@ public:
|
||||
* has the given components. Attempting to dereference the returned iterator
|
||||
* results in undefined behavior.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the entity following the last entity that has the
|
||||
* given components.
|
||||
*/
|
||||
|
||||
@@ -204,19 +204,19 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> final {
|
||||
using reverse_iterator = iterable_view_iterator<typename basic_view::reverse_iterator>;
|
||||
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
return iterator{view.begin(), view};
|
||||
return { view.begin(), view };
|
||||
}
|
||||
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
return iterator{view.end(), view};
|
||||
return { view.end(), view };
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{view.rbegin(), view};
|
||||
return { view.rbegin(), view };
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{view.rend(), view};
|
||||
return { view.rend(), view };
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
* @return An iterator to the first entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const {
|
||||
return iterator{view->begin(), view->end(), view->begin(), unchecked(view), filter};
|
||||
return { view->begin(), view->end(), view->begin(), unchecked(view), filter };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -350,7 +350,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const {
|
||||
return iterator{view->begin(), view->end(), view->end(), unchecked(view), filter};
|
||||
return { view->begin(), view->end(), view->end(), unchecked(view), filter };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
* @return An iterator to the first entity of the reversed view.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rbegin() const {
|
||||
return reverse_iterator{view->rbegin(), view->rend(), view->rbegin(), unchecked(view), filter};
|
||||
return { view->rbegin(), view->rend(), view->rbegin(), unchecked(view), filter };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
* reversed view.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rend() const {
|
||||
return reverse_iterator{view->rbegin(), view->rend(), view->rend(), unchecked(view), filter};
|
||||
return { view->rbegin(), view->rend(), view->rend(), unchecked(view), filter };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -685,19 +685,19 @@ class basic_view<Entity, exclude_t<>, Component> final {
|
||||
>;
|
||||
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
return iterator{pool->basic_sparse_set<entity_type>::begin(), pool->begin()};
|
||||
return { pool->basic_sparse_set<entity_type>::begin(), pool->begin() };
|
||||
}
|
||||
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
return iterator{pool->basic_sparse_set<entity_type>::end(), pool->end()};
|
||||
return { pool->basic_sparse_set<entity_type>::end(), pool->end() };
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{pool->basic_sparse_set<entity_type>::rbegin(), pool->rbegin()};
|
||||
return { pool->basic_sparse_set<entity_type>::rbegin(), pool->rbegin() };
|
||||
}
|
||||
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
return reverse_iterator{pool->basic_sparse_set<entity_type>::rend(), pool->rend()};
|
||||
return { pool->basic_sparse_set<entity_type>::rend(), pool->rend() };
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -774,10 +774,6 @@ public:
|
||||
* The returned iterator points to the first entity of the view. If the view
|
||||
* is empty, the returned iterator will be equal to `end()`.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the first entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
@@ -791,10 +787,6 @@ public:
|
||||
* the view. Attempting to dereference the returned iterator results in
|
||||
* undefined behavior.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
@@ -807,10 +799,6 @@ public:
|
||||
* The returned iterator points to the first entity of the reversed view. If
|
||||
* the view is empty, the returned iterator will be equal to `rend()`.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the first entity of the reversed view.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
@@ -825,10 +813,6 @@ public:
|
||||
* the reversed view. Attempting to dereference the returned iterator
|
||||
* results in undefined behavior.
|
||||
*
|
||||
* @note
|
||||
* Iterators stay true to the order imposed to the underlying data
|
||||
* structures.
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* reversed view.
|
||||
*/
|
||||
|
||||
@@ -23,11 +23,11 @@ TEST(NonOwningGroup, Functionalities) {
|
||||
ASSERT_TRUE((cgroup.empty<const int, const char>()));
|
||||
|
||||
const auto e0 = registry.create();
|
||||
registry.emplace<char>(e0);
|
||||
registry.emplace<char>(e0, '1');
|
||||
|
||||
const auto e1 = registry.create();
|
||||
registry.emplace<int>(e1);
|
||||
registry.emplace<char>(e1);
|
||||
registry.emplace<int>(e1, 42);
|
||||
registry.emplace<char>(e1, '2');
|
||||
|
||||
ASSERT_FALSE(group.empty());
|
||||
ASSERT_FALSE(group.empty<int>());
|
||||
@@ -57,10 +57,6 @@ TEST(NonOwningGroup, Functionalities) {
|
||||
ASSERT_EQ(group.size<int>(), 1u);
|
||||
ASSERT_EQ(cgroup.size<const char>(), 2u);
|
||||
|
||||
registry.get<char>(e0) = '1';
|
||||
registry.get<char>(e1) = '2';
|
||||
registry.get<int>(e1) = 42;
|
||||
|
||||
for(auto entity: group) {
|
||||
ASSERT_EQ(std::get<0>(cgroup.get<const int, const char>(entity)), 42);
|
||||
ASSERT_EQ(std::get<1>(group.get<int, char>(entity)), '2');
|
||||
@@ -330,14 +326,14 @@ TEST(NonOwningGroup, ConstNonConstAndAllInBetween) {
|
||||
entt::registry registry;
|
||||
auto group = registry.group(entt::get<int, empty_type, const char>);
|
||||
|
||||
ASSERT_EQ(group.size(), decltype(group.size()){0});
|
||||
ASSERT_EQ(group.size(), 0u);
|
||||
|
||||
const auto entity = registry.create();
|
||||
registry.emplace<int>(entity, 0);
|
||||
registry.emplace<empty_type>(entity);
|
||||
registry.emplace<char>(entity, 'c');
|
||||
|
||||
ASSERT_EQ(group.size(), decltype(group.size()){1});
|
||||
ASSERT_EQ(group.size(), 1u);
|
||||
|
||||
static_assert(std::is_same_v<decltype(group.get<int>({})), int &>);
|
||||
static_assert(std::is_same_v<decltype(group.get<const char>({})), const char &>);
|
||||
@@ -596,11 +592,11 @@ TEST(OwningGroup, Functionalities) {
|
||||
ASSERT_TRUE((cgroup.empty<const int, const char>()));
|
||||
|
||||
const auto e0 = registry.create();
|
||||
registry.emplace<char>(e0);
|
||||
registry.emplace<char>(e0, '1');
|
||||
|
||||
const auto e1 = registry.create();
|
||||
registry.emplace<int>(e1);
|
||||
registry.emplace<char>(e1);
|
||||
registry.emplace<int>(e1, 42);
|
||||
registry.emplace<char>(e1, '2');
|
||||
|
||||
ASSERT_FALSE(group.empty());
|
||||
ASSERT_FALSE(group.empty<int>());
|
||||
@@ -630,10 +626,6 @@ TEST(OwningGroup, Functionalities) {
|
||||
ASSERT_EQ(group.size<int>(), 1u);
|
||||
ASSERT_EQ(cgroup.size<const char>(), 2u);
|
||||
|
||||
registry.get<char>(e0) = '1';
|
||||
registry.get<char>(e1) = '2';
|
||||
registry.get<int>(e1) = 42;
|
||||
|
||||
ASSERT_EQ(*(cgroup.raw<const int>() + 0), 42);
|
||||
ASSERT_EQ(*(group.raw<int>() + 0), 42);
|
||||
|
||||
@@ -984,7 +976,7 @@ TEST(OwningGroup, ConstNonConstAndAllInBetween) {
|
||||
entt::registry registry;
|
||||
auto group = registry.group<int, const char>(entt::get<empty_type, double, const float>);
|
||||
|
||||
ASSERT_EQ(group.size(), decltype(group.size()){0});
|
||||
ASSERT_EQ(group.size(), 0u);
|
||||
|
||||
const auto entity = registry.create();
|
||||
registry.emplace<int>(entity, 0);
|
||||
@@ -993,7 +985,7 @@ TEST(OwningGroup, ConstNonConstAndAllInBetween) {
|
||||
registry.emplace<double>(entity, 0.);
|
||||
registry.emplace<float>(entity, 0.f);
|
||||
|
||||
ASSERT_EQ(group.size(), decltype(group.size()){1});
|
||||
ASSERT_EQ(group.size(), 1u);
|
||||
|
||||
static_assert(std::is_same_v<decltype(group.get<int>({})), int &>);
|
||||
static_assert(std::is_same_v<decltype(group.get<const char>({})), const char &>);
|
||||
|
||||
@@ -145,13 +145,13 @@ TEST(SingleComponentView, ConstNonConstAndAllInBetween) {
|
||||
auto view = registry.view<int>();
|
||||
auto cview = std::as_const(registry).view<const int>();
|
||||
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){0});
|
||||
ASSERT_EQ(cview.size(), decltype(cview.size()){0});
|
||||
ASSERT_EQ(view.size(), 0u);
|
||||
ASSERT_EQ(cview.size(), 0u);
|
||||
|
||||
registry.emplace<int>(registry.create(), 0);
|
||||
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){1});
|
||||
ASSERT_EQ(cview.size(), decltype(cview.size()){1});
|
||||
ASSERT_EQ(view.size(), 1u);
|
||||
ASSERT_EQ(cview.size(), 1u);
|
||||
|
||||
static_assert(std::is_same_v<typename decltype(view)::raw_type, int>);
|
||||
static_assert(std::is_same_v<typename decltype(cview)::raw_type, const int>);
|
||||
@@ -187,13 +187,13 @@ TEST(SingleComponentView, ConstNonConstAndAllInBetweenWithEmptyType) {
|
||||
auto view = registry.view<empty_type>();
|
||||
auto cview = std::as_const(registry).view<const empty_type>();
|
||||
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){0});
|
||||
ASSERT_EQ(cview.size(), decltype(cview.size()){0});
|
||||
ASSERT_EQ(view.size(), 0u);
|
||||
ASSERT_EQ(cview.size(), 0u);
|
||||
|
||||
registry.emplace<empty_type>(registry.create());
|
||||
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){1});
|
||||
ASSERT_EQ(cview.size(), decltype(cview.size()){1});
|
||||
ASSERT_EQ(view.size(), 1u);
|
||||
ASSERT_EQ(cview.size(), 1u);
|
||||
|
||||
static_assert(std::is_same_v<typename decltype(view)::raw_type, empty_type>);
|
||||
static_assert(std::is_same_v<typename decltype(cview)::raw_type, const empty_type>);
|
||||
@@ -314,11 +314,11 @@ TEST(MultiComponentView, Functionalities) {
|
||||
auto cview = std::as_const(registry).view<const int, const char>();
|
||||
|
||||
const auto e0 = registry.create();
|
||||
registry.emplace<char>(e0);
|
||||
registry.emplace<char>(e0, '1');
|
||||
|
||||
const auto e1 = registry.create();
|
||||
registry.emplace<int>(e1);
|
||||
registry.emplace<char>(e1);
|
||||
registry.emplace<int>(e1, 42);
|
||||
registry.emplace<char>(e1, '2');
|
||||
|
||||
ASSERT_EQ(*view.begin(), e1);
|
||||
ASSERT_EQ(*view.rbegin(), e1);
|
||||
@@ -334,11 +334,7 @@ TEST(MultiComponentView, Functionalities) {
|
||||
ASSERT_NE(cview.begin(), cview.end());
|
||||
ASSERT_NE(view.rbegin(), view.rend());
|
||||
ASSERT_NE(cview.rbegin(), cview.rend());
|
||||
ASSERT_EQ(view.size_hint(), decltype(view.size_hint()){1});
|
||||
|
||||
registry.get<char>(e0) = '1';
|
||||
registry.get<char>(e1) = '2';
|
||||
registry.get<int>(e1) = 42;
|
||||
ASSERT_EQ(view.size_hint(), 1u);
|
||||
|
||||
for(auto entity: view) {
|
||||
ASSERT_EQ(std::get<0>(cview.get<const int, const char>(entity)), 42);
|
||||
@@ -422,7 +418,7 @@ TEST(MultiComponentView, Contains) {
|
||||
ASSERT_TRUE(view.contains(e1));
|
||||
}
|
||||
|
||||
TEST(MultiComponentView, Empty) {
|
||||
TEST(MultiComponentView, SizeHint) {
|
||||
entt::registry registry;
|
||||
|
||||
const auto e0 = registry.create();
|
||||
@@ -557,14 +553,14 @@ TEST(MultiComponentView, ConstNonConstAndAllInBetween) {
|
||||
entt::registry registry;
|
||||
auto view = registry.view<int, empty_type, const char>();
|
||||
|
||||
ASSERT_EQ(view.size_hint(), decltype(view.size_hint()){0});
|
||||
ASSERT_EQ(view.size_hint(), 0u);
|
||||
|
||||
const auto entity = registry.create();
|
||||
registry.emplace<int>(entity, 0);
|
||||
registry.emplace<empty_type>(entity);
|
||||
registry.emplace<char>(entity, 'c');
|
||||
|
||||
ASSERT_EQ(view.size_hint(), decltype(view.size_hint()){1});
|
||||
ASSERT_EQ(view.size_hint(), 1u);
|
||||
|
||||
static_assert(std::is_same_v<decltype(view.get<int>({})), int &>);
|
||||
static_assert(std::is_same_v<decltype(view.get<const char>({})), const char &>);
|
||||
|
||||
Reference in New Issue
Block a user