view: removed multi component view ::raw and ::data (breaking changes)
This commit is contained in:
@@ -342,44 +342,6 @@ public:
|
||||
return (std::min)({ std::get<pool_type<Component> *>(pools)->size()... });
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Direct access to the list of components of a given pool.
|
||||
*
|
||||
* The returned pointer is such that range
|
||||
* `[raw<Comp>(), raw<Comp>() + size<Comp>())` is always a valid range, even
|
||||
* if the container is empty.
|
||||
*
|
||||
* @note
|
||||
* Components are in the reverse order as returned by the `begin`/`end`
|
||||
* iterators.
|
||||
*
|
||||
* @tparam Comp Type of component in which one is interested.
|
||||
* @return A pointer to the array of components.
|
||||
*/
|
||||
template<typename Comp>
|
||||
[[nodiscard]] Comp * raw() const ENTT_NOEXCEPT {
|
||||
return std::get<pool_type<Comp> *>(pools)->raw();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Direct access to the list of entities of a given pool.
|
||||
*
|
||||
* The returned pointer is such that range
|
||||
* `[data<Comp>(), data<Comp>() + size<Comp>())` is always a valid range,
|
||||
* even if the container is empty.
|
||||
*
|
||||
* @note
|
||||
* Entities are in the reverse order as returned by the `begin`/`end`
|
||||
* iterators.
|
||||
*
|
||||
* @tparam Comp Type of component in which one is interested.
|
||||
* @return A pointer to the array of entities.
|
||||
*/
|
||||
template<typename Comp>
|
||||
[[nodiscard]] const entity_type * data() const ENTT_NOEXCEPT {
|
||||
return std::get<pool_type<Comp> *>(pools)->data();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns an iterator to the first entity of the view.
|
||||
*
|
||||
|
||||
@@ -315,14 +315,6 @@ TEST(MultiComponentView, Functionalities) {
|
||||
ASSERT_EQ(std::get<1>(view.get<int, char>(entity)), '2');
|
||||
ASSERT_EQ(cview.get<const char>(entity), '2');
|
||||
}
|
||||
|
||||
ASSERT_EQ(*(view.data<int>() + 0), e1);
|
||||
ASSERT_EQ(*(view.data<char>() + 0), e0);
|
||||
ASSERT_EQ(*(cview.data<const char>() + 1), e1);
|
||||
|
||||
ASSERT_EQ(*(view.raw<int>() + 0), 42);
|
||||
ASSERT_EQ(*(view.raw<char>() + 0), '1');
|
||||
ASSERT_EQ(*(cview.raw<const char>() + 1), '2');
|
||||
}
|
||||
|
||||
TEST(MultiComponentView, Iterator) {
|
||||
@@ -548,8 +540,6 @@ TEST(MultiComponentView, ConstNonConstAndAllInBetween) {
|
||||
static_assert(std::is_same_v<decltype(view.get<int>({})), int &>);
|
||||
static_assert(std::is_same_v<decltype(view.get<const char>({})), const char &>);
|
||||
static_assert(std::is_same_v<decltype(view.get<int, const char>({})), std::tuple<int &, const char &>>);
|
||||
static_assert(std::is_same_v<decltype(view.raw<const char>()), const char *>);
|
||||
static_assert(std::is_same_v<decltype(view.raw<int>()), int *>);
|
||||
|
||||
view.each([](auto &&i, auto &&c) {
|
||||
static_assert(std::is_same_v<decltype(i), int &>);
|
||||
|
||||
Reference in New Issue
Block a user