Просмотр исходного кода

*: a handful of changes to please clang-format

Michele Caini 4 лет назад
Родитель
Сommit
13d901fbfa

+ 7 - 2
src/entt/core/any.hpp

@@ -23,8 +23,13 @@ namespace entt {
  */
 template<std::size_t Len, std::size_t Align>
 class basic_any {
-    enum class operation: std::uint8_t { COPY, MOVE, DTOR, COMP, GET, TYPE };
-    enum class policy: std::uint8_t { OWNER, REF, CREF };
+    enum class operation: std::uint8_t {
+        COPY, MOVE, DTOR, COMP, GET, TYPE
+    };
+
+    enum class policy: std::uint8_t {
+        OWNER, REF, CREF
+    };
 
     using storage_type = std::aligned_storage_t<Len + !Len, Align>;
     using vtable_type = const void *(const operation, const basic_any &, const void *);

+ 4 - 8
src/entt/core/compressed_pair.hpp

@@ -53,9 +53,7 @@ private:
 
 
 template<typename Type, std::size_t Tag>
-struct compressed_pair_element<Type, Tag, std::enable_if_t<is_ebco_eligible_v<Type>>>
-    : Type
-{
+struct compressed_pair_element<Type, Tag, std::enable_if_t<is_ebco_eligible_v<Type>>>: Type {
     template<bool Dummy = true, typename = std::enable_if_t<Dummy && std::is_default_constructible_v<Type>>>
     compressed_pair_element()
         : Type{}
@@ -100,9 +98,8 @@ struct compressed_pair_element<Type, Tag, std::enable_if_t<is_ebco_eligible_v<Ty
  * @tparam Second The type of the second element that the pair stores.
  */
 template<typename First, typename Second>
-class compressed_pair final:
-    internal::compressed_pair_element<First, 0u>,
-    internal::compressed_pair_element<Second, 1u>
+class compressed_pair final
+    : internal::compressed_pair_element<First, 0u>, internal::compressed_pair_element<Second, 1u>
 {
     using first_base = internal::compressed_pair_element<First, 0u>;
     using second_base = internal::compressed_pair_element<Second, 1u>;
@@ -245,8 +242,7 @@ public:
  * @tparam Other Type of value to use to initialize the second element.
  */
 template<typename Type, typename Other>
-compressed_pair(Type &&, Other &&)
--> compressed_pair<std::decay_t<Type>, std::decay_t<Other>>;
+compressed_pair(Type &&, Other &&) -> compressed_pair<std::decay_t<Type>, std::decay_t<Other>>;
 
 
 /**

+ 1 - 2
src/entt/core/hashed_string.hpp

@@ -203,8 +203,7 @@ private:
  * @param str Human-readable identifer.
  */
 template<typename Char, std::size_t N>
-basic_hashed_string(const Char (&str)[N])
--> basic_hashed_string<Char>;
+basic_hashed_string(const Char (&str)[N]) -> basic_hashed_string<Char>;
 
 
 /**

+ 4 - 9
src/entt/core/type_traits.hpp

@@ -20,9 +20,7 @@ namespace entt {
 template<std::size_t N>
 struct choice_t
     // Unfortunately, doxygen cannot parse such a construct.
-    /*! @cond TURN_OFF_DOXYGEN */
-    : choice_t<N-1>
-    /*! @endcond */
+    : /*! @cond TURN_OFF_DOXYGEN */ choice_t<N - 1> /*! @endcond */
 {};
 
 
@@ -595,13 +593,11 @@ template<typename>
 
 
 template<typename Type>
-[[nodiscard]] constexpr auto is_equality_comparable(choice_t<0>)
--> decltype(std::declval<Type>() == std::declval<Type>()) { return true; }
+[[nodiscard]] constexpr auto is_equality_comparable(choice_t<0>) -> decltype(std::declval<Type>() == std::declval<Type>()) { return true; }
 
 
 template<typename Type>
-[[nodiscard]] constexpr auto is_equality_comparable(choice_t<1>)
--> decltype(std::declval<typename Type::value_type>(), std::declval<Type>() == std::declval<Type>()) {
+[[nodiscard]] constexpr auto is_equality_comparable(choice_t<1>) -> decltype(std::declval<typename Type::value_type>(), std::declval<Type>() == std::declval<Type>()) {
     if constexpr(is_iterator_v<Type>) {
         return true;
     } else if constexpr(std::is_same_v<typename Type::value_type, Type>) {
@@ -613,8 +609,7 @@ template<typename Type>
 
 
 template<typename Type>
-[[nodiscard]] constexpr auto is_equality_comparable(choice_t<2>)
--> decltype(std::declval<typename Type::mapped_type>(), std::declval<Type>() == std::declval<Type>()) {
+[[nodiscard]] constexpr auto is_equality_comparable(choice_t<2>) -> decltype(std::declval<typename Type::mapped_type>(), std::declval<Type>() == std::declval<Type>()) {
     return is_equality_comparable<typename Type::key_type>(choice<2>) && is_equality_comparable<typename Type::mapped_type>(choice<2>);
 }
 

+ 1 - 2
src/entt/core/utility.hpp

@@ -60,8 +60,7 @@ struct overloaded: Func... {
  * @tparam Func Types of function objects.
  */
 template<class... Func>
-overloaded(Func...)
--> overloaded<Func...>;
+overloaded(Func...) -> overloaded<Func...>;
 
 
 /**

+ 12 - 24
src/entt/entity/group.hpp

@@ -442,7 +442,7 @@ public:
                 static_assert(std::is_invocable_v<Compare, const entity_type, const entity_type>, "Invalid comparison function");
                 handler->sort(std::move(compare), std::move(algo), std::forward<Args>(args)...);
             } else {
-                auto forward_compare = [this, &compare](const entity_type lhs, const entity_type rhs) {
+                auto comp = [this, &compare](const entity_type lhs, const entity_type rhs) {
                     if constexpr(sizeof...(Component) == 1) {
                         return compare((std::get<storage_type<Component> *>(pools)->get(lhs), ...), (std::get<storage_type<Component> *>(pools)->get(rhs), ...));
                     } else {
@@ -450,7 +450,7 @@ public:
                     }
                 };
 
-                handler->sort(std::move(forward_compare), std::move(algo), std::forward<Args>(args)...);
+                handler->sort(std::move(comp), std::move(algo), std::forward<Args>(args)...);
             }
         }
     }
@@ -606,35 +606,23 @@ class basic_group<Entity, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...
         {}
 
         [[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
-            return length ? iterator{
-                std::get<0>(pools)->basic_common_type::end() - *length,
-                std::make_tuple((std::get<storage_type<Owned> *>(pools)->end() - *length)...),
-                std::make_tuple(std::get<storage_type<Get> *>(pools)...)
-            } : iterator{{}, std::make_tuple(decltype(std::get<storage_type<Owned> *>(pools)->end()){}...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
+            auto it = length ? (std::get<0>(pools)->basic_common_type::end() - *length) : typename basic_common_type::iterator{};
+            return iterator{std::move(it), std::make_tuple((std::get<storage_type<Owned> *>(pools)->end() - *length)...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
         }
 
         [[nodiscard]] iterator end() const ENTT_NOEXCEPT {
-            return length ? iterator{
-                std::get<0>(pools)->basic_common_type::end(),
-                std::make_tuple((std::get<storage_type<Owned> *>(pools)->end())...),
-                std::make_tuple(std::get<storage_type<Get> *>(pools)...)
-            } : iterator{{}, std::make_tuple(decltype(std::get<storage_type<Owned> *>(pools)->end()){}...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
+            auto it = length ? std::get<0>(pools)->basic_common_type::end() : typename basic_common_type::iterator{};
+            return iterator{std::move(it), std::make_tuple((std::get<storage_type<Owned> *>(pools)->end())...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
         }
 
         [[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
-            return length ? reverse_iterator{
-                std::get<0>(pools)->basic_common_type::rbegin(),
-                std::make_tuple((std::get<storage_type<Owned> *>(pools)->rbegin())...),
-                std::make_tuple(std::get<storage_type<Get> *>(pools)...)
-            } : reverse_iterator{{}, std::make_tuple(decltype(std::get<storage_type<Owned> *>(pools)->rbegin()){}...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
+            auto it = length ? std::get<0>(pools)->basic_common_type::rbegin() : typename basic_common_type::reverse_iterator{};
+            return reverse_iterator{std::move(it), std::make_tuple((std::get<storage_type<Owned> *>(pools)->rbegin())...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
         }
 
         [[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
-            return length ? reverse_iterator{
-                std::get<0>(pools)->basic_common_type::rbegin() + *length,
-                std::make_tuple((std::get<storage_type<Owned> *>(pools)->rbegin() + *length)...),
-                std::make_tuple(std::get<storage_type<Get> *>(pools)...)
-            } : reverse_iterator{{}, std::make_tuple(decltype(std::get<storage_type<Owned> *>(pools)->rbegin()){}...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
+            auto it = length ? (std::get<0>(pools)->basic_common_type::rbegin() + *length) : typename basic_common_type::reverse_iterator{};
+            return reverse_iterator{std::move(it), std::make_tuple((std::get<storage_type<Owned> *>(pools)->rbegin() + *length)...), std::make_tuple(std::get<storage_type<Get> *>(pools)...)};
         }
 
     private:
@@ -941,7 +929,7 @@ public:
             static_assert(std::is_invocable_v<Compare, const entity_type, const entity_type>, "Invalid comparison function");
             cpool->sort_n(*length, std::move(compare), std::move(algo), std::forward<Args>(args)...);
         } else {
-            auto forward_compare = [this, &compare](const entity_type lhs, const entity_type rhs) {
+            auto comp = [this, &compare](const entity_type lhs, const entity_type rhs) {
                 if constexpr(sizeof...(Component) == 1) {
                     return compare((std::get<storage_type<Component> *>(pools)->get(lhs), ...), (std::get<storage_type<Component> *>(pools)->get(rhs), ...));
                 } else {
@@ -949,7 +937,7 @@ public:
                 }
             };
 
-            cpool->sort_n(*length, std::move(forward_compare), std::move(algo), std::forward<Args>(args)...);
+            cpool->sort_n(*length, std::move(comp), std::move(algo), std::forward<Args>(args)...);
         }
 
         [this](auto *head, auto *... other) {

+ 4 - 9
src/entt/entity/handle.hpp

@@ -56,11 +56,8 @@ struct basic_handle {
      */
     template<typename Other, typename... Args>
     operator basic_handle<Other, Args...>() const ENTT_NOEXCEPT {
-        static_assert(
-            (std::is_same_v<Other, Entity> || std::is_same_v<std::remove_const_t<Other>, Entity>)
-            && (sizeof...(Type) == 0 || ((sizeof...(Args) != 0 && sizeof...(Args) <= sizeof...(Type)) && ... && (type_list_contains_v<type_list<Type...>, Args>))),
-            "Invalid conversion between different handles"
-        );
+        static_assert(std::is_same_v<Other, Entity> || std::is_same_v<std::remove_const_t<Other>, Entity>, "Invalid conversion between different handles");
+        static_assert((sizeof...(Type) == 0 || ((sizeof...(Args) != 0 && sizeof...(Args) <= sizeof...(Type)) && ... && (type_list_contains_v<type_list<Type...>, Args>))), "Invalid conversion between different handles");
 
         return reg ? basic_handle<Other, Args...>{*reg, entt} : basic_handle<Other, Args...>{};
     }
@@ -322,8 +319,7 @@ template<typename... Args, typename... Other>
  * @tparam Entity A valid entity type (see entt_traits for more details).
  */
 template<typename Entity>
-basic_handle(basic_registry<Entity> &, Entity)
--> basic_handle<Entity>;
+basic_handle(basic_registry<Entity> &, Entity) -> basic_handle<Entity>;
 
 
 /**
@@ -331,8 +327,7 @@ basic_handle(basic_registry<Entity> &, Entity)
  * @tparam Entity A valid entity type (see entt_traits for more details).
  */
 template<typename Entity>
-basic_handle(const basic_registry<Entity> &, Entity)
--> basic_handle<const Entity>;
+basic_handle(const basic_registry<Entity> &, Entity) -> basic_handle<const Entity>;
 
 
 }

+ 4 - 3
src/entt/entity/observer.hpp

@@ -215,14 +215,15 @@ class basic_observer {
     struct matcher_handler<matcher<type_list<Reject...>, type_list<Require...>, type_list<NoneOf...>, AllOf...>> {
         template<std::size_t Index, typename... Ignore>
         static void maybe_valid_if(basic_observer &obs, basic_registry<Entity> &reg, const Entity entt) {
-            if([&reg, entt]() {
+            auto condition = [&reg, entt]() {
                 if constexpr(sizeof...(Ignore) == 0) {
                     return reg.template all_of<AllOf..., Require...>(entt) && !reg.template any_of<NoneOf..., Reject...>(entt);
                 } else {
                     return reg.template all_of<AllOf..., Require...>(entt) && ((std::is_same_v<Ignore..., NoneOf> || !reg.template any_of<NoneOf>(entt)) && ...) && !reg.template any_of<Reject...>(entt);
                 }
-            }())
-            {
+            };
+
+            if(condition()) {
                 if(!obs.storage.contains(entt)) {
                     obs.storage.emplace(entt);
                 }

+ 17 - 19
src/entt/entity/organizer.hpp

@@ -381,9 +381,7 @@ public:
             std::apply(Candidate, to_args(reg, typename resource_type::args{}));
         };
 
-        track_dependencies(vertices.size(), requires_registry, typename resource_type::ro{}, typename resource_type::rw{});
-
-        vertices.push_back({
+        vertex_data vdata {
             resource_type::ro::size,
             resource_type::rw::size,
             name,
@@ -392,7 +390,10 @@ public:
             +[](const bool rw, type_info *buffer, const std::size_t length) { return rw ? fill_dependencies(typename resource_type::rw{}, buffer, length) : fill_dependencies(typename resource_type::ro{}, buffer, length); },
             +[](basic_registry<entity_type> &reg) { void(to_args(reg, typename resource_type::args{})); },
             type_id<std::integral_constant<decltype(Candidate), Candidate>>()
-        });
+        };
+
+        track_dependencies(vertices.size(), requires_registry, typename resource_type::ro{}, typename resource_type::rw{});
+        vertices.push_back(std::move(vdata));
     }
 
     /**
@@ -414,22 +415,19 @@ public:
             std::apply(Candidate, std::tuple_cat(std::forward_as_tuple(*curr), to_args(reg, typename resource_type::args{})));
         };
 
-        track_dependencies(vertices.size(), requires_registry, typename resource_type::ro{}, typename resource_type::rw{});
-
-        vertices.push_back({
+        vertex_data vdata {
             resource_type::ro::size,
             resource_type::rw::size,
             name,
             &value_or_instance,
             callback,
-            +[](const bool rw, type_info *buffer, const std::size_t length) {
-                return rw ? fill_dependencies(typename resource_type::rw{}, buffer, length) : fill_dependencies(typename resource_type::ro{}, buffer, length);
-            },
-            +[](basic_registry<entity_type> &reg) {
-                void(to_args(reg, typename resource_type::args{}));
-            },
+            +[](const bool rw, type_info *buffer, const std::size_t length) { return rw ? fill_dependencies(typename resource_type::rw{}, buffer, length) : fill_dependencies(typename resource_type::ro{}, buffer, length); },
+            +[](basic_registry<entity_type> &reg) { void(to_args(reg, typename resource_type::args{})); },
             type_id<std::integral_constant<decltype(Candidate), Candidate>>()
-        });
+        };
+
+        track_dependencies(vertices.size(), requires_registry, typename resource_type::ro{}, typename resource_type::rw{});
+        vertices.push_back(std::move(vdata));
     }
 
     /**
@@ -445,18 +443,18 @@ public:
         using resource_type = internal::resource<type_list<>, type_list<Req...>>;
         track_dependencies(vertices.size(), true, typename resource_type::ro{}, typename resource_type::rw{});
 
-        vertices.push_back({
+        vertex_data vdata {
             resource_type::ro::size,
             resource_type::rw::size,
             name,
             payload,
             func,
-            +[](const bool rw, type_info *buffer, const std::size_t length) {
-                return rw ? fill_dependencies(typename resource_type::rw{}, buffer, length) : fill_dependencies(typename resource_type::ro{}, buffer, length);
-            },
+            +[](const bool rw, type_info *buffer, const std::size_t length) { return rw ? fill_dependencies(typename resource_type::rw{}, buffer, length) : fill_dependencies(typename resource_type::ro{}, buffer, length); },
             nullptr,
             type_info{}
-        });
+        };
+
+        vertices.push_back(std::move(vdata));
     }
 
     /**

+ 24 - 24
src/entt/entity/registry.hpp

@@ -389,7 +389,7 @@ public:
             return create();
         } else {
             auto *it = &free_list;
-            for(; entity_traits::to_entity(*it) != req; it = &entities[entity_traits::to_entity(*it)]);
+            for(; entity_traits::to_entity(*it) != req; it = &entities[entity_traits::to_entity(*it)]) { continue; }
             *it = entity_traits::combine(curr, entity_traits::to_integral(*it));
             return (entities[req] = hint);
         }
@@ -1215,17 +1215,16 @@ public:
         constexpr auto size = sizeof...(Owned) + sizeof...(Get) + sizeof...(Exclude);
         handler_type *handler = nullptr;
 
-        if(auto it = std::find_if(groups.cbegin(), groups.cend(), [size](const auto &gdata) {
+        auto it = std::find_if(groups.cbegin(), groups.cend(), [size](const auto &gdata) {
             return gdata.size == size
-                && (gdata.owned(type_hash<std::remove_const_t<Owned>>::value()) && ...)
-                && (gdata.get(type_hash<std::remove_const_t<Get>>::value()) && ...)
-                && (gdata.exclude(type_hash<Exclude>::value()) && ...);
-        }); it != groups.cend())
-        {
-            handler = static_cast<handler_type *>(it->group.get());
-        }
+                   && (gdata.owned(type_hash<std::remove_const_t<Owned>>::value()) && ...)
+                   && (gdata.get(type_hash<std::remove_const_t<Get>>::value()) && ...)
+                   && (gdata.exclude(type_hash<Exclude>::value()) && ...);
+        });
 
-        if(!handler) {
+        if(it != groups.cend()) {
+            handler = static_cast<handler_type *>(it->group.get());
+        } else {
             group_data candidate = {
                 size,
                 { new handler_type{}, [](void *instance) { delete static_cast<handler_type *>(instance); } },
@@ -1242,11 +1241,13 @@ public:
             if constexpr(sizeof...(Owned) == 0) {
                 groups.push_back(std::move(candidate));
             } else {
-                ENTT_ASSERT(std::all_of(groups.cbegin(), groups.cend(), [size](const auto &gdata) {
+                [[maybe_unused]] auto has_conflict = [size](const auto &gdata) {
                     const auto overlapping = (0u + ... + gdata.owned(type_hash<std::remove_const_t<Owned>>::value()));
                     const auto sz = overlapping + (0u + ... + gdata.get(type_hash<std::remove_const_t<Get>>::value())) + (0u + ... + gdata.exclude(type_hash<Exclude>::value()));
                     return !overlapping || ((sz == size) || (sz == gdata.size));
-                }), "Conflicting groups");
+                };
+
+                ENTT_ASSERT(std::all_of(groups.cbegin(), groups.cend(), std::move(has_conflict)), "Conflicting groups");
 
                 const auto next = std::find_if_not(groups.cbegin(), groups.cend(), [size](const auto &gdata) {
                     return !(0u + ... + gdata.owned(type_hash<std::remove_const_t<Owned>>::value())) || (size > gdata.size);
@@ -1296,13 +1297,14 @@ public:
      */
     template<typename... Owned, typename... Get, typename... Exclude>
     [[nodiscard]] basic_group<Entity, owned_t<std::add_const_t<Owned>...>, get_t<std::add_const_t<Get>...>, exclude_t<Exclude...>> group_if_exists(get_t<Get...>, exclude_t<Exclude...> = {}) const {
-        if(auto it = std::find_if(groups.cbegin(), groups.cend(), [](const auto &gdata) {
+        auto it = std::find_if(groups.cbegin(), groups.cend(), [](const auto &gdata) {
             return gdata.size == (sizeof...(Owned) + sizeof...(Get) + sizeof...(Exclude))
-                && (gdata.owned(type_hash<std::remove_const_t<Owned>>::value()) && ...)
-                && (gdata.get(type_hash<std::remove_const_t<Get>>::value()) && ...)
-                && (gdata.exclude(type_hash<Exclude>::value()) && ...);
-            }); it == groups.cend())
-        {
+                   && (gdata.owned(type_hash<std::remove_const_t<Owned>>::value()) && ...)
+                   && (gdata.get(type_hash<std::remove_const_t<Get>>::value()) && ...)
+                   && (gdata.exclude(type_hash<Exclude>::value()) && ...);
+        });
+
+        if(it == groups.cend()) {
             return {};
         } else {
             using handler_type = group_handler<exclude_t<Exclude...>, get_t<std::remove_const_t<Get>...>, std::remove_const_t<Owned>...>;
@@ -1359,9 +1361,8 @@ public:
     template<typename... Owned, typename... Get, typename... Exclude>
     [[nodiscard]] bool sortable(const basic_group<Entity, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> &) ENTT_NOEXCEPT {
         constexpr auto size = sizeof...(Owned) + sizeof...(Get) + sizeof...(Exclude);
-        return std::find_if(groups.cbegin(), groups.cend(), [size](const auto &gdata) {
-            return (0u + ... + gdata.owned(type_hash<std::remove_const_t<Owned>>::value())) && (size < gdata.size);
-        }) == groups.cend();
+        auto pred = [size](const auto &gdata) { return (0u + ... + gdata.owned(type_hash<std::remove_const_t<Owned>>::value())) && (size < gdata.size); };
+        return std::find_if(groups.cbegin(), groups.cend(), std::move(pred)) == groups.cend();
     }
 
     /**
@@ -1418,9 +1419,8 @@ public:
             cpool->sort(std::move(compare), std::move(algo), std::forward<Args>(args)...);
         } else {
             if constexpr(std::is_invocable_v<Compare, decltype(cpool->get({})), decltype(cpool->get({}))>) {
-                cpool->sort([cpool, compare = std::move(compare)](const auto lhs, const auto rhs) {
-                    return compare(std::as_const(cpool->get(lhs)), std::as_const(cpool->get(rhs)));
-                }, std::move(algo), std::forward<Args>(args)...);
+                auto comp = [cpool, compare = std::move(compare)](const auto lhs, const auto rhs) { return compare(std::as_const(cpool->get(lhs)), std::as_const(cpool->get(rhs))); };
+                cpool->sort(std::move(comp), std::move(algo), std::forward<Args>(args)...);
             } else {
                 cpool->sort(std::move(compare), std::move(algo), std::forward<Args>(args)...);
             }

+ 7 - 5
src/entt/entity/runtime_view.hpp

@@ -87,7 +87,7 @@ class basic_runtime_view final {
         }
 
         view_iterator & operator++() {
-            while(++it != (*pools)[0]->end() && !valid());
+            while(++it != (*pools)[0]->end() && !valid()) { continue; }
             return *this;
         }
 
@@ -97,7 +97,7 @@ class basic_runtime_view final {
         }
 
         view_iterator & operator--() ENTT_NOEXCEPT {
-            while(--it != (*pools)[0]->begin() && !valid());
+            while(--it != (*pools)[0]->begin() && !valid()) { continue; }
             return *this;
         }
 
@@ -156,10 +156,12 @@ public:
         : pools{std::move(cpools)},
           filter{std::move(epools)}
     {
-        // brings the best candidate (if any) on front of the vector
-        std::rotate(pools.begin(), std::min_element(pools.begin(), pools.end(), [](const auto *lhs, const auto *rhs) {
+        auto candidate = std::min_element(pools.begin(), pools.end(), [](const auto *lhs, const auto *rhs) {
             return (!lhs && rhs) || (lhs && rhs && lhs->size() < rhs->size());
-        }), pools.end());
+        });
+
+        // brings the best candidate (if any) on front of the vector
+        std::rotate(pools.begin(), candidate, pools.end());
     }
 
     /**

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

@@ -771,7 +771,7 @@ public:
     /*! @brief Removes all tombstones from the packed array of a sparse set. */
     void compact() {
         size_type next = count;
-        for(; next && packed[next - 1u] == tombstone; --next);
+        for(; next && packed[next - 1u] == tombstone; --next) { continue; }
 
         for(auto *it = &free_list; *it != null && next; it = std::addressof(packed[entity_traits::to_entity(*it)])) {
             if(const size_type pos = entity_traits::to_entity(*it); pos < next) {
@@ -781,7 +781,7 @@ public:
                 const auto entity = static_cast<typename entity_traits::entity_type>(pos);
                 sparse_ref(packed[pos]) = entity_traits::combine(entity, entity_traits::to_integral(packed[pos]));
                 *it = entity_traits::combine(static_cast<typename entity_traits::entity_type>(next), entity_traits::reserved);
-                for(; next && packed[next - 1u] == tombstone; --next);
+                for(; next && packed[next - 1u] == tombstone; --next) { continue; }
             }
         }
 

+ 4 - 7
src/entt/entity/view.hpp

@@ -149,7 +149,7 @@ public:
     }
 
     view_iterator & operator++() ENTT_NOEXCEPT {
-        while(++it != last && !valid());
+        while(++it != last && !valid()) { continue; }
         return *this;
     }
 
@@ -159,7 +159,7 @@ public:
     }
 
     view_iterator & operator--() ENTT_NOEXCEPT {
-        while(--it != first && !valid());
+        while(--it != first && !valid()) { continue; }
         return *this;
     }
 
@@ -689,9 +689,7 @@ private:
  * @tparam Component Type of component iterated by the view.
  */
 template<typename Entity, typename Component>
-class basic_view<Entity, get_t<Component>, exclude_t<>, 
-    // Yeah, there is a reason why void_t and enable_if_t were combined here. Try removing the first one and let me know. :)
-    std::void_t<std::enable_if_t<!in_place_delete_v<std::remove_const_t<Component>>>>
+class basic_view<Entity, get_t<Component>, exclude_t<>, std::void_t<std::enable_if_t<!in_place_delete_v<std::remove_const_t<Component>>>>
 > {
     template<typename, typename, typename, typename>
     friend class basic_view;
@@ -1001,8 +999,7 @@ private:
  * @param storage The storage for the types to iterate.
  */
 template<typename... Storage>
-basic_view(Storage &... storage)
--> basic_view<std::common_type_t<typename Storage::entity_type...>, get_t<constness_as_t<typename Storage::value_type, Storage>...>, exclude_t<>>;
+basic_view(Storage &... storage) -> basic_view<std::common_type_t<typename Storage::entity_type...>, get_t<constness_as_t<typename Storage::value_type, Storage>...>, exclude_t<>>;
 
 
 }

+ 16 - 12
src/entt/meta/factory.hpp

@@ -77,6 +77,7 @@ class meta_factory<Type, Spec...>: public meta_factory<Type> {
             nullptr,
             property[0u],
             property[1u]
+            // tricks clang-format
         };
 
         property[0u] = std::move(key);
@@ -199,6 +200,7 @@ class meta_factory<Type> {
             &meta_arg<type_list<type_list_element_t<type_list_element_t<Index, args_type>::size != 1u, type_list_element_t<Index, args_type>>...>>,
             [](meta_handle instance, meta_any value) -> bool { return (meta_setter<Type, value_list_element_v<Index, Setter>>(*instance.operator->(), value) || ...); },
             &meta_getter<Type, Getter, Policy>
+            // tricks clang-format
         };
 
         link_data_if_required(id, node);
@@ -244,9 +246,8 @@ public:
         static internal::meta_base_node node{
             nullptr,
             internal::meta_node<Base>::resolve(),
-            [](const void *instance) ENTT_NOEXCEPT -> const void * {
-                return static_cast<const Base *>(static_cast<const Type *>(instance));
-            }
+            [](const void *instance) ENTT_NOEXCEPT -> const void * { return static_cast<const Base *>(static_cast<const Type *>(instance)); }
+            // tricks clang-format
         };
 
         link_base_if_required(node);
@@ -272,9 +273,8 @@ public:
         static internal::meta_conv_node node{
             nullptr,
             internal::meta_node<conv_type>::resolve(),
-            [](const void *instance) -> meta_any {
-                return forward_as_meta(static_cast<const Type *>(instance)->*Candidate)();
-            }
+            [](const void *instance) -> meta_any { return forward_as_meta(static_cast<const Type *>(instance)->*Candidate)(); }
+            // tricks clang-format
         };
 
         link_conv_if_required(node);
@@ -289,9 +289,8 @@ public:
         static internal::meta_conv_node node{
             nullptr,
             internal::meta_node<conv_type>::resolve(),
-            [](const void *instance) -> meta_any {
-                return forward_as_meta(Candidate(*static_cast<const Type *>(instance)));
-            }
+            [](const void *instance) -> meta_any { return forward_as_meta(Candidate(*static_cast<const Type *>(instance))); }
+            // tricks clang-format
         };
 
         link_conv_if_required(node);
@@ -314,9 +313,8 @@ public:
         static internal::meta_conv_node node{
             nullptr,
             internal::meta_node<std::remove_const_t<std::remove_reference_t<To>>>::resolve(),
-            [](const void *instance) -> meta_any {
-                return forward_as_meta(static_cast<To>(*static_cast<const Type *>(instance)));
-            }
+            [](const void *instance) -> meta_any { return forward_as_meta(static_cast<To>(*static_cast<const Type *>(instance))); }
+            // tricks clang-format
         };
 
         link_conv_if_required(node);
@@ -346,6 +344,7 @@ public:
             descriptor::args_type::size,
             &meta_arg<typename descriptor::args_type>,
             &meta_construct<Type, Candidate, Policy>
+            // tricks clang-format
         };
 
         link_ctor_if_required(node);
@@ -371,6 +370,7 @@ public:
             descriptor::args_type::size,
             &meta_arg<typename descriptor::args_type>,
             &meta_construct<Type, Args...>
+            // tricks clang-format
         };
 
         link_ctor_if_required(node);
@@ -430,6 +430,7 @@ public:
                 &meta_arg<type_list<data_type>>,
                 &meta_setter<Type, Data>,
                 &meta_getter<Type, Data, Policy>
+                // tricks clang-format
             };
 
             link_data_if_required(id, node);
@@ -473,6 +474,7 @@ public:
                 &meta_arg<type_list<>>,
                 &meta_setter<Type, Setter>,
                 &meta_getter<Type, Getter, Policy>
+                // tricks clang-format
             };
 
             link_data_if_required(id, node);
@@ -491,6 +493,7 @@ public:
                 &meta_arg<type_list<type_list_element_t<args_type::size != 1u, args_type>>>,
                 &meta_setter<Type, Setter>,
                 &meta_getter<Type, Getter, Policy>
+                // tricks clang-format
             };
 
             link_data_if_required(id, node);
@@ -546,6 +549,7 @@ public:
             internal::meta_node<std::conditional_t<std::is_same_v<Policy, as_void_t>, void, std::remove_const_t<std::remove_reference_t<typename descriptor::return_type>>>>::resolve(),
             &meta_arg<typename descriptor::args_type>,
             &meta_invoke<Type, Candidate, Policy>
+            // tricks clang-format
         };
 
         link_func_if_required(id, node);

+ 9 - 3
src/entt/meta/meta.hpp

@@ -153,7 +153,9 @@ private:
 
 /*! @brief Opaque wrapper for values of any type. */
 class meta_any {
-    enum class operation { DEREF, SEQ, ASSOC };
+    enum class operation: std::uint8_t {
+        DEREF, SEQ, ASSOC
+    };
 
     using vtable_type = void(const operation, const any &, void *);
 
@@ -1436,7 +1438,9 @@ bool meta_any::set(const id_type id, Type &&value) {
 
 /*! @brief Opaque iterator for sequence containers. */
 class meta_sequence_container::meta_iterator {
-    enum class operation { INCR, DEREF };
+    enum class operation: std::uint8_t {
+        INCR, DEREF
+    };
 
     using vtable_type = void(const operation, const any &, void *);
 
@@ -1637,7 +1641,9 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
 
 /*! @brief Opaque iterator for associative containers. */
 class meta_associative_container::meta_iterator {
-    enum class operation { INCR, DEREF };
+    enum class operation: std::uint8_t {
+        INCR, DEREF
+    };
 
     using vtable_type = void(const operation, const any &, void *);
 

+ 3 - 3
src/entt/meta/node.hpp

@@ -170,9 +170,8 @@ class ENTT_API meta_node {
             static meta_template_node node{
                 meta_template_traits<Type>::args_type::size,
                 meta_node<typename meta_template_traits<Type>::class_type>::resolve(),
-                [](const std::size_t index) ENTT_NOEXCEPT {
-                    return meta_arg_node(typename meta_template_traits<Type>::args_type{}, index);
-                }
+                [](const std::size_t index) ENTT_NOEXCEPT { return meta_arg_node(typename meta_template_traits<Type>::args_type{}, index); }
+                // tricks clang-format
             };
 
             return &node;
@@ -201,6 +200,7 @@ public:
             meta_default_constructor(),
             meta_conversion_helper(),
             meta_template_info()
+            // tricks clang-format
         };
 
         return &node;

+ 4 - 4
src/entt/meta/resolve.hpp

@@ -39,8 +39,8 @@ template<typename Type>
  * @return The meta type associated with the given identifier, if any.
  */
 [[nodiscard]] inline meta_type resolve(const id_type id) ENTT_NOEXCEPT {
-    for(auto *curr = *internal::meta_context::global(); curr; curr = curr->next) {
-        if(curr->id == id) {
+    for(auto &&curr: resolve()) {
+        if(curr.id() == id) {
             return curr;
         }
     }
@@ -56,8 +56,8 @@ template<typename Type>
  * @return The meta type associated with the given type info object, if any.
  */
 [[nodiscard]] inline meta_type resolve(const type_info info) ENTT_NOEXCEPT {
-    for(auto *curr = *internal::meta_context::global(); curr; curr = curr->next) {
-        if(curr->info == info) {
+    for(auto &&curr: resolve()) {
+        if(curr.info() == info) {
             return curr;
         }
     }

+ 6 - 1
src/entt/process/process.hpp

@@ -323,7 +323,12 @@ struct process_adaptor: process<process_adaptor<Func, Delta>, Delta>, private Fu
      * @param data Optional data.
      */
     void update(const Delta delta, void *data) {
-        Func::operator()(delta, data, [this]() { this->succeed(); }, [this]() { this->fail(); });
+        Func::operator()(
+            delta,
+            data,
+            [this]() { this->succeed(); },
+            [this]() { this->fail(); }
+        );
     }
 };
 

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

@@ -335,8 +335,7 @@ template<typename Ret, typename... Args>
  * @tparam Candidate Function or member to connect to the delegate.
  */
 template<auto Candidate>
-delegate(connect_arg_t<Candidate>)
--> delegate<std::remove_pointer_t<internal::function_pointer_t<decltype(Candidate)>>>;
+delegate(connect_arg_t<Candidate>) -> delegate<std::remove_pointer_t<internal::function_pointer_t<decltype(Candidate)>>>;
 
 
 /**
@@ -345,8 +344,7 @@ delegate(connect_arg_t<Candidate>)
  * @tparam Type Type of class or type of payload.
  */
 template<auto Candidate, typename Type>
-delegate(connect_arg_t<Candidate>, Type &&)
--> delegate<std::remove_pointer_t<internal::function_pointer_t<decltype(Candidate), Type>>>;
+delegate(connect_arg_t<Candidate>, Type &&) -> delegate<std::remove_pointer_t<internal::function_pointer_t<decltype(Candidate), Type>>>;
 
 
 /**
@@ -355,8 +353,7 @@ delegate(connect_arg_t<Candidate>, Type &&)
  * @tparam Args Types of arguments of a function type.
  */
 template<typename Ret, typename... Args>
-delegate(Ret(*)(const void *, Args...), const void * = nullptr)
--> delegate<Ret(Args...)>;
+delegate(Ret(*)(const void *, Args...), const void * = nullptr) -> delegate<Ret(Args...)>;
 
 
 }

+ 2 - 2
src/entt/signal/emitter.hpp

@@ -59,8 +59,8 @@ class emitter {
         [[nodiscard]] bool empty() const ENTT_NOEXCEPT override {
             auto pred = [](auto &&element) { return element.first; };
 
-            return std::all_of(once_list.cbegin(), once_list.cend(), pred) &&
-                    std::all_of(on_list.cbegin(), on_list.cend(), pred);
+            return std::all_of(once_list.cbegin(), once_list.cend(), pred)
+                && std::all_of(on_list.cbegin(), on_list.cend(), pred);
         }
 
         void clear() ENTT_NOEXCEPT override {

+ 3 - 5
src/entt/signal/sigh.hpp

@@ -501,9 +501,8 @@ public:
     void disconnect(Type *value_or_instance) {
         if(value_or_instance) {
             auto &calls = signal->calls;
-            calls.erase(std::remove_if(calls.begin(), calls.end(), [value_or_instance](const auto &delegate) {
-                return delegate.instance() == value_or_instance;
-            }), calls.end());
+            auto predicate = [value_or_instance](const auto &delegate) { return delegate.instance() == value_or_instance; };
+            calls.erase(std::remove_if(calls.begin(), calls.end(), std::move(predicate)), calls.end());
         }
     }
 
@@ -528,8 +527,7 @@ private:
  * @tparam Args Types of arguments of a function type.
  */
 template<typename Ret, typename... Args>
-sink(sigh<Ret(Args...)> &)
--> sink<Ret(Args...)>;
+sink(sigh<Ret(Args...)> &) -> sink<Ret(Args...)>;
 
 
 }