Răsfoiți Sursa

stl: std::index_sequence

skypjack 2 zile în urmă
părinte
comite
402f040f16

+ 2 - 2
src/entt/core/compressed_pair.hpp

@@ -29,7 +29,7 @@ struct compressed_pair_element {
         : value{stl::forward<Arg>(arg)} {}
 
     template<typename... Args, stl::size_t... Index>
-    constexpr compressed_pair_element(stl::tuple<Args...> args, std::index_sequence<Index...>) noexcept(stl::is_nothrow_constructible_v<Type, Args...>)
+    constexpr compressed_pair_element(stl::tuple<Args...> args, stl::index_sequence<Index...>) noexcept(stl::is_nothrow_constructible_v<Type, Args...>)
         : value{stl::forward<Args>(std::get<Index>(args))...} {}
 
     [[nodiscard]] constexpr reference get() noexcept {
@@ -61,7 +61,7 @@ struct compressed_pair_element<Type, Tag>: Type {
         : base_type{stl::forward<Arg>(arg)} {}
 
     template<typename... Args, stl::size_t... Index>
-    constexpr compressed_pair_element(stl::tuple<Args...> args, std::index_sequence<Index...>) noexcept(stl::is_nothrow_constructible_v<base_type, Args...>)
+    constexpr compressed_pair_element(stl::tuple<Args...> args, stl::index_sequence<Index...>) noexcept(stl::is_nothrow_constructible_v<base_type, Args...>)
         : base_type{stl::forward<Args>(std::get<Index>(args))...} {}
 
     [[nodiscard]] constexpr reference get() noexcept {

+ 1 - 1
src/entt/core/ident.hpp

@@ -16,7 +16,7 @@ namespace entt {
 template<typename... Type>
 class ident {
     template<typename Curr, stl::size_t... Index>
-    [[nodiscard]] static ENTT_CONSTEVAL id_type get(std::index_sequence<Index...>) noexcept {
+    [[nodiscard]] static ENTT_CONSTEVAL id_type get(stl::index_sequence<Index...>) noexcept {
         return (0 + ... + (stl::is_same_v<Curr, type_list_element_t<Index, type_list<stl::decay_t<Type>...>>> ? id_type{Index} : id_type{}));
     }
 

+ 1 - 1
src/entt/core/type_traits.hpp

@@ -740,7 +740,7 @@ template<typename>
 [[nodiscard]] ENTT_CONSTEVAL bool dispatch_is_equality_comparable();
 
 template<typename Type, stl::size_t... Index>
-[[nodiscard]] ENTT_CONSTEVAL bool unpack_maybe_equality_comparable(std::index_sequence<Index...>) {
+[[nodiscard]] ENTT_CONSTEVAL bool unpack_maybe_equality_comparable(stl::index_sequence<Index...>) {
     return (dispatch_is_equality_comparable<stl::tuple_element_t<Index, Type>>() && ...);
 }
 

+ 2 - 2
src/entt/entity/group.hpp

@@ -280,7 +280,7 @@ class basic_group<owned_t<>, get_t<Get...>, exclude_t<Exclude...>> {
     static constexpr stl::size_t index_of = type_list_index_v<stl::remove_const_t<Type>, type_list<typename Get::element_type..., typename Exclude::element_type...>>;
 
     template<stl::size_t... Index>
-    [[nodiscard]] auto pools_for(std::index_sequence<Index...>) const noexcept {
+    [[nodiscard]] auto pools_for(stl::index_sequence<Index...>) const noexcept {
         using return_type = stl::tuple<Get *...>;
         return descriptor ? return_type{static_cast<Get *>(descriptor->template storage<Index>())...} : return_type{};
     }
@@ -694,7 +694,7 @@ class basic_group<owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> {
     static constexpr stl::size_t index_of = type_list_index_v<stl::remove_const_t<Type>, type_list<typename Owned::element_type..., typename Get::element_type..., typename Exclude::element_type...>>;
 
     template<stl::size_t... Index, stl::size_t... Other>
-    [[nodiscard]] auto pools_for(std::index_sequence<Index...>, std::index_sequence<Other...>) const noexcept {
+    [[nodiscard]] auto pools_for(stl::index_sequence<Index...>, stl::index_sequence<Other...>) const noexcept {
         using return_type = stl::tuple<Owned *..., Get *...>;
         return descriptor ? return_type{static_cast<Owned *>(descriptor->template storage<Index>())..., static_cast<Get *>(descriptor->template storage<sizeof...(Owned) + Other>())...} : return_type{};
     }

+ 6 - 6
src/entt/entity/view.hpp

@@ -47,7 +47,7 @@ template<typename It>
 }
 
 template<typename Result, typename View, typename Other, stl::size_t... GLhs, stl::size_t... ELhs, stl::size_t... GRhs, stl::size_t... ERhs>
-[[nodiscard]] Result view_pack(const View &view, const Other &other, std::index_sequence<GLhs...>, std::index_sequence<ELhs...>, std::index_sequence<GRhs...>, std::index_sequence<ERhs...>) {
+[[nodiscard]] Result view_pack(const View &view, const Other &other, stl::index_sequence<GLhs...>, stl::index_sequence<ELhs...>, stl::index_sequence<GRhs...>, stl::index_sequence<ERhs...>) {
     Result elem{};
     // friend-initialization, avoid multiple calls to refresh
     elem.pools = {view.template storage<GLhs>()..., other.template storage<GRhs>()...};
@@ -154,7 +154,7 @@ struct extended_view_iterator final {
     }
 
     [[nodiscard]] reference operator*() const noexcept {
-        return [this]<auto... Index>(std::index_sequence<Index...>) {
+        return [this]<auto... Index>(stl::index_sequence<Index...>) {
             return stl::tuple_cat(stl::make_tuple(*it), static_cast<Get *>(const_cast<constness_as_t<typename Get::base_type, Get> *>(std::get<Index>(it.pools)))->get_as_tuple(*it)...);
         }(stl::index_sequence_for<Get...>{});
     }
@@ -211,7 +211,7 @@ class basic_view;
 template<cvref_unqualified Type, bool Checked, stl::size_t Get, stl::size_t Exclude>
 class basic_common_view {
     template<typename Return, typename View, typename Other, stl::size_t... GLhs, stl::size_t... ELhs, stl::size_t... GRhs, stl::size_t... ERhs>
-    friend Return internal::view_pack(const View &, const Other &, std::index_sequence<GLhs...>, std::index_sequence<ELhs...>, std::index_sequence<GRhs...>, std::index_sequence<ERhs...>);
+    friend Return internal::view_pack(const View &, const Other &, stl::index_sequence<GLhs...>, stl::index_sequence<ELhs...>, stl::index_sequence<GRhs...>, stl::index_sequence<ERhs...>);
 
     [[nodiscard]] auto offset() const noexcept {
         ENTT_ASSERT(index != Get, "Invalid view");
@@ -427,7 +427,7 @@ class basic_view<get_t<Get...>, exclude_t<Exclude...>>
     }
 
     template<stl::size_t Curr, typename Func, stl::size_t... Index>
-    void each(Func func, std::index_sequence<Index...>) const {
+    void each(Func func, stl::index_sequence<Index...>) const {
         for(const auto curr: storage<Curr>()->each()) {
             if(const auto entt = std::get<0>(curr); (!internal::tombstone_check_v<Get...> || (entt != tombstone)) && ((Curr == Index || base_type::pool_at(Index)->contains(entt)) && ...) && base_type::none_of(entt)) {
                 if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, stl::declval<basic_view>().get({})))>) {
@@ -593,7 +593,7 @@ public:
     template<stl::size_t... Index>
     [[nodiscard]] decltype(auto) get(const entity_type entt) const {
         if constexpr(sizeof...(Index) == 0) {
-            return [this, entt]<auto... Idx>(std::index_sequence<Idx...>) {
+            return [this, entt]<auto... Idx>(stl::index_sequence<Idx...>) {
                 return stl::tuple_cat(this->storage<Idx>()->get_as_tuple(entt)...);
             }(stl::index_sequence_for<Get...>{});
         } else if constexpr(sizeof...(Index) == 1) {
@@ -620,7 +620,7 @@ public:
      */
     template<typename Func>
     void each(Func func) const {
-        [this, &func]<auto... Index>(std::index_sequence<Index...> seq) {
+        [this, &func]<auto... Index>(stl::index_sequence<Index...> seq) {
             if(const auto *view = base_type::handle(); view != nullptr) {
                 ((view == base_type::pool_at(Index) ? each<Index>(stl::move(func), seq) : void()), ...);
             }

+ 2 - 2
src/entt/meta/utility.hpp

@@ -205,7 +205,7 @@ template<typename Policy, typename Candidate, typename... Args>
 }
 
 template<typename Type, typename Policy, typename Candidate, stl::size_t... Index>
-[[nodiscard]] meta_any meta_invoke(meta_any &instance, Candidate &&candidate, [[maybe_unused]] meta_any *const args, std::index_sequence<Index...>) {
+[[nodiscard]] meta_any meta_invoke(meta_any &instance, Candidate &&candidate, [[maybe_unused]] meta_any *const args, stl::index_sequence<Index...>) {
     using descriptor = meta_function_helper_t<Type, stl::remove_reference_t<Candidate>>;
 
     // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) - waiting for C++20 (and std::span)
@@ -228,7 +228,7 @@ template<typename Type, typename Policy, typename Candidate, stl::size_t... Inde
 }
 
 template<typename Type, typename... Args, stl::size_t... Index>
-[[nodiscard]] meta_any meta_construct(const meta_ctx &ctx, meta_any *const args, std::index_sequence<Index...>) {
+[[nodiscard]] meta_any meta_construct(const meta_ctx &ctx, meta_any *const args, stl::index_sequence<Index...>) {
     // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) - waiting for C++20 (and std::span)
     if(((args + Index)->allow_cast<Args>() && ...)) {
         return meta_any{ctx, stl::in_place_type<Type>, (args + Index)->cast<Args>()...};

+ 1 - 1
src/entt/poly/poly.hpp

@@ -95,7 +95,7 @@ class poly_vtable {
     }
 
     template<typename Type, auto... Index>
-    [[nodiscard]] static auto fill_vtable(std::index_sequence<Index...>) noexcept {
+    [[nodiscard]] static auto fill_vtable(stl::index_sequence<Index...>) noexcept {
         vtable_type impl{};
         (fill_vtable_entry<Type, value_list_element_v<Index, typename Concept::template impl<Type>>>(std::get<Index>(impl)), ...);
         return impl;

+ 3 - 3
src/entt/signal/delegate.hpp

@@ -69,7 +69,7 @@ class delegate<Ret(Args...)> {
     using delegate_type = return_type(const void *, Args...);
 
     template<auto Candidate, stl::size_t... Index>
-    [[nodiscard]] auto wrap(std::index_sequence<Index...>) noexcept {
+    [[nodiscard]] auto wrap(stl::index_sequence<Index...>) noexcept {
         return [](const void *, Args... args) -> return_type {
             [[maybe_unused]] const auto arguments = stl::forward_as_tuple(stl::forward<Args>(args)...);
             [[maybe_unused]] constexpr auto offset = !stl::is_invocable_r_v<Ret, decltype(Candidate), type_list_element_t<Index, type_list<Args...>>...> * (sizeof...(Args) - sizeof...(Index));
@@ -78,7 +78,7 @@ class delegate<Ret(Args...)> {
     }
 
     template<auto Candidate, typename Type, stl::size_t... Index>
-    [[nodiscard]] auto wrap(Type &, std::index_sequence<Index...>) noexcept {
+    [[nodiscard]] auto wrap(Type &, stl::index_sequence<Index...>) noexcept {
         return [](const void *payload, Args... args) -> return_type {
             Type *curr = static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(payload));
             [[maybe_unused]] const auto arguments = stl::forward_as_tuple(stl::forward<Args>(args)...);
@@ -88,7 +88,7 @@ class delegate<Ret(Args...)> {
     }
 
     template<auto Candidate, typename Type, stl::size_t... Index>
-    [[nodiscard]] auto wrap(Type *, std::index_sequence<Index...>) noexcept {
+    [[nodiscard]] auto wrap(Type *, stl::index_sequence<Index...>) noexcept {
         return [](const void *payload, Args... args) -> return_type {
             Type *curr = static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(payload));
             [[maybe_unused]] const auto arguments = stl::forward_as_tuple(stl::forward<Args>(args)...);

+ 1 - 0
src/entt/stl/utility.hpp

@@ -14,6 +14,7 @@ using std::in_place;
 using std::in_place_t;
 using std::in_place_type;
 using std::in_place_type_t;
+using std::index_sequence;
 using std::index_sequence_for;
 using std::make_pair;
 using std::move;

+ 1 - 1
src/entt/tools/davey.hpp

@@ -195,7 +195,7 @@ static void present_entity(const meta_ctx &ctx, const Entity entt, const It from
 }
 
 template<typename... Get, typename... Exclude, stl::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...>) {
+static void present_view(const meta_ctx &ctx, const basic_view<get_t<Get...>, exclude_t<Exclude...>> &view, stl::index_sequence<Index...>) {
     using view_type = basic_view<get_t<Get...>, exclude_t<Exclude...>>;
     const stl::array<const typename view_type::common_type *, sizeof...(Index)> range{view.template storage<Index>()...};