stl: std::array
This commit is contained in:
@@ -135,8 +135,8 @@ public:
|
||||
|
||||
template<typename... OGType, typename... EType>
|
||||
group_handler(stl::tuple<OGType &...> ogpool, stl::tuple<EType &...> epool)
|
||||
: pools{stl::apply([](auto &&...cpool) { return std::array<common_type *, (Owned + Get)>{&cpool...}; }, ogpool)},
|
||||
filter{stl::apply([](auto &&...cpool) { return std::array<common_type *, Exclude>{&cpool...}; }, epool)} {
|
||||
: pools{stl::apply([](auto &&...cpool) { return stl::array<common_type *, (Owned + Get)>{&cpool...}; }, ogpool)},
|
||||
filter{stl::apply([](auto &&...cpool) { return stl::array<common_type *, Exclude>{&cpool...}; }, epool)} {
|
||||
stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::push_on_construct>(*this), cpool.on_destroy().template connect<&group_handler::remove_if>(*this)), ...); }, ogpool);
|
||||
stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::remove_if>(*this), cpool.on_destroy().template connect<&group_handler::push_on_destroy>(*this)), ...); }, epool);
|
||||
common_setup();
|
||||
@@ -166,8 +166,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<common_type *, (Owned + Get)> pools;
|
||||
std::array<common_type *, Exclude> filter;
|
||||
stl::array<common_type *, (Owned + Get)> pools;
|
||||
stl::array<common_type *, Exclude> filter;
|
||||
std::size_t len{};
|
||||
};
|
||||
|
||||
@@ -206,8 +206,8 @@ public:
|
||||
|
||||
template<typename Allocator, typename... GType, typename... EType>
|
||||
group_handler(const Allocator &allocator, stl::tuple<GType &...> gpool, stl::tuple<EType &...> epool)
|
||||
: pools{stl::apply([](auto &&...cpool) { return std::array<common_type *, Get>{&cpool...}; }, gpool)},
|
||||
filter{stl::apply([](auto &&...cpool) { return std::array<common_type *, Exclude>{&cpool...}; }, epool)},
|
||||
: pools{stl::apply([](auto &&...cpool) { return stl::array<common_type *, Get>{&cpool...}; }, gpool)},
|
||||
filter{stl::apply([](auto &&...cpool) { return stl::array<common_type *, Exclude>{&cpool...}; }, epool)},
|
||||
elem{allocator} {
|
||||
stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::push_on_construct>(*this), cpool.on_destroy().template connect<&group_handler::remove_if>(*this)), ...); }, gpool);
|
||||
stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::remove_if>(*this), cpool.on_destroy().template connect<&group_handler::push_on_destroy>(*this)), ...); }, epool);
|
||||
@@ -232,8 +232,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<common_type *, Get> pools;
|
||||
std::array<common_type *, Exclude> filter;
|
||||
stl::array<common_type *, Get> pools;
|
||||
stl::array<common_type *, Exclude> filter;
|
||||
common_type elem;
|
||||
};
|
||||
|
||||
|
||||
@@ -696,7 +696,7 @@ public:
|
||||
size_type count{};
|
||||
|
||||
if constexpr(stl::is_same_v<It, typename common_type::iterator>) {
|
||||
std::array cpools{static_cast<common_type *>(&assure<Type>()), static_cast<common_type *>(&assure<Other>())...};
|
||||
stl::array cpools{static_cast<common_type *>(&assure<Type>()), static_cast<common_type *>(&assure<Other>())...};
|
||||
|
||||
for(auto from = cpools.begin(), to = cpools.end(); from != to; ++from) {
|
||||
if constexpr(sizeof...(Other) != 0u) {
|
||||
@@ -747,7 +747,7 @@ public:
|
||||
template<typename Type, typename... Other, stl::input_iterator It>
|
||||
void erase(It first, It last) {
|
||||
if constexpr(stl::is_same_v<It, typename common_type::iterator>) {
|
||||
std::array cpools{static_cast<common_type *>(&assure<Type>()), static_cast<common_type *>(&assure<Other>())...};
|
||||
stl::array cpools{static_cast<common_type *>(&assure<Type>()), static_cast<common_type *>(&assure<Other>())...};
|
||||
|
||||
for(auto from = cpools.begin(), to = cpools.end(); from != to; ++from) {
|
||||
if constexpr(sizeof...(Other) != 0u) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
filter{},
|
||||
index{} {}
|
||||
|
||||
view_iterator(iterator_type first, std::array<const Type *, Get> value, std::array<const Type *, Exclude> excl, const std::size_t idx) noexcept
|
||||
view_iterator(iterator_type first, stl::array<const Type *, Get> value, stl::array<const Type *, Exclude> excl, const std::size_t idx) noexcept
|
||||
: it{first},
|
||||
pools{value},
|
||||
filter{excl},
|
||||
@@ -123,8 +123,8 @@ public:
|
||||
|
||||
private:
|
||||
iterator_type it;
|
||||
std::array<const Type *, Get> pools;
|
||||
std::array<const Type *, Exclude> filter;
|
||||
stl::array<const Type *, Get> pools;
|
||||
stl::array<const Type *, Exclude> filter;
|
||||
difference_type index;
|
||||
};
|
||||
|
||||
@@ -238,7 +238,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
basic_common_view(std::array<const Type *, Get> value, std::array<const Type *, Exclude> excl) noexcept
|
||||
basic_common_view(stl::array<const Type *, Get> value, stl::array<const Type *, Exclude> excl) noexcept
|
||||
: pools{value},
|
||||
filter{excl},
|
||||
index{Get} {
|
||||
@@ -387,8 +387,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<const common_type *, Get> pools{};
|
||||
std::array<const common_type *, Exclude> filter{};
|
||||
stl::array<const common_type *, Get> pools{};
|
||||
stl::array<const common_type *, Exclude> filter{};
|
||||
const common_type *placeholder{internal::view_placeholder<common_type>()};
|
||||
size_type index{Get};
|
||||
};
|
||||
|
||||
@@ -1014,7 +1014,7 @@ struct meta_func: meta_object<internal::meta_func_node> {
|
||||
template<typename Instance = meta_handle, typename... Args>
|
||||
// NOLINTNEXTLINE(modernize-use-nodiscard)
|
||||
meta_any invoke(Instance &&instance, Args &&...args) const {
|
||||
return invoke(stl::forward<Instance>(instance), std::array<meta_any, sizeof...(Args)>{meta_any{*ctx, stl::forward<Args>(args)}...}.data(), sizeof...(Args));
|
||||
return invoke(stl::forward<Instance>(instance), stl::array<meta_any, sizeof...(Args)>{meta_any{*ctx, stl::forward<Args>(args)}...}.data(), sizeof...(Args));
|
||||
}
|
||||
|
||||
/*! @copydoc meta_data::traits */
|
||||
@@ -1385,7 +1385,7 @@ public:
|
||||
*/
|
||||
template<typename... Args>
|
||||
[[nodiscard]] meta_any construct(Args &&...args) const {
|
||||
return construct(std::array<meta_any, sizeof...(Args)>{meta_any{*ctx, stl::forward<Args>(args)}...}.data(), sizeof...(Args));
|
||||
return construct(stl::array<meta_any, sizeof...(Args)>{meta_any{*ctx, stl::forward<Args>(args)}...}.data(), sizeof...(Args));
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
|
||||
}
|
||||
|
||||
@@ -1451,7 +1451,7 @@ public:
|
||||
template<typename Instance = meta_handle, typename... Args>
|
||||
// NOLINTNEXTLINE(modernize-use-nodiscard)
|
||||
meta_any invoke(const id_type id, Instance &&instance, Args &&...args) const {
|
||||
return invoke(id, stl::forward<Instance>(instance), std::array<meta_any, sizeof...(Args)>{meta_any{*ctx, stl::forward<Args>(args)}...}.data(), sizeof...(Args));
|
||||
return invoke(id, stl::forward<Instance>(instance), stl::array<meta_any, sizeof...(Args)>{meta_any{*ctx, stl::forward<Args>(args)}...}.data(), sizeof...(Args));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -190,7 +190,7 @@ const meta_type_node &resolve(const meta_context &) noexcept;
|
||||
template<typename... Args>
|
||||
[[nodiscard]] const meta_type_node &meta_arg_node(const meta_context &context, type_list<Args...>, const std::size_t index) noexcept {
|
||||
using resolve_type = const meta_type_node &(*)(const meta_context &) noexcept;
|
||||
constexpr std::array<resolve_type, sizeof...(Args)> list{&resolve<stl::remove_cvref_t<Args>>...};
|
||||
constexpr stl::array<resolve_type, sizeof...(Args)> list{&resolve<stl::remove_cvref_t<Args>>...};
|
||||
ENTT_ASSERT(index < sizeof...(Args), "Out of bounds");
|
||||
return list[index](context);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
/*! @cond ENTT_INTERNAL */
|
||||
namespace entt::stl {
|
||||
|
||||
using std::array;
|
||||
|
||||
} // namespace entt::stl
|
||||
/*! @endcond */
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ static void present_entity(const meta_ctx &ctx, const Entity entt, const It from
|
||||
template<typename... Get, typename... Exclude, std::size_t... Index>
|
||||
static void present_view(const meta_ctx &ctx, const basic_view<get_t<Get...>, exclude_t<Exclude...>> &view, std::index_sequence<Index...>) {
|
||||
using view_type = basic_view<get_t<Get...>, exclude_t<Exclude...>>;
|
||||
const std::array<const typename view_type::common_type *, sizeof...(Index)> range{view.template storage<Index>()...};
|
||||
const stl::array<const typename view_type::common_type *, sizeof...(Index)> range{view.template storage<Index>()...};
|
||||
|
||||
for(auto tup: view.each()) {
|
||||
const auto entt = std::get<0>(tup);
|
||||
|
||||
Reference in New Issue
Block a user