Răsfoiți Sursa

introduced clang-format (close #733)

Michele Caini 4 ani în urmă
părinte
comite
80b5ed3d22
100 a modificat fișierele cu 1397 adăugiri și 2081 ștergeri
  1. 41 0
      .clang-format
  2. 33 43
      src/entt/config/config.h
  3. 0 2
      src/entt/config/version.h
  4. 7 14
      src/entt/core/algorithm.hpp
  5. 43 53
      src/entt/core/any.hpp
  6. 20 23
      src/entt/core/attribute.h
  7. 33 54
      src/entt/core/compressed_pair.hpp
  8. 1 18
      src/entt/core/enum.hpp
  9. 1 6
      src/entt/core/family.hpp
  10. 1 8
      src/entt/core/fwd.hpp
  11. 16 37
      src/entt/core/hashed_string.hpp
  12. 2 7
      src/entt/core/ident.hpp
  13. 1 11
      src/entt/core/memory.hpp
  14. 1 7
      src/entt/core/monostate.hpp
  15. 1 6
      src/entt/core/tuple.hpp
  16. 17 34
      src/entt/core/type_info.hpp
  17. 25 107
      src/entt/core/type_traits.hpp
  18. 14 21
      src/entt/core/utility.hpp
  19. 2 10
      src/entt/entity/component.hpp
  20. 4 29
      src/entt/entity/entity.hpp
  21. 2 34
      src/entt/entity/fwd.hpp
  22. 27 45
      src/entt/entity/group.hpp
  23. 11 20
      src/entt/entity/handle.hpp
  24. 2 15
      src/entt/entity/helper.hpp
  25. 10 21
      src/entt/entity/observer.hpp
  26. 22 43
      src/entt/entity/organizer.hpp
  27. 1 7
      src/entt/entity/poly_storage.hpp
  28. 44 49
      src/entt/entity/registry.hpp
  29. 13 21
      src/entt/entity/runtime_view.hpp
  30. 21 31
      src/entt/entity/snapshot.hpp
  31. 17 34
      src/entt/entity/sparse_set.hpp
  32. 37 56
      src/entt/entity/storage.hpp
  33. 3 13
      src/entt/entity/utility.hpp
  34. 44 75
      src/entt/entity/view.hpp
  35. 3 8
      src/entt/locator/locator.hpp
  36. 1 6
      src/entt/meta/adl_pointer.hpp
  37. 21 45
      src/entt/meta/container.hpp
  38. 5 16
      src/entt/meta/ctx.hpp
  39. 15 27
      src/entt/meta/factory.hpp
  40. 1 12
      src/entt/meta/fwd.hpp
  41. 74 138
      src/entt/meta/meta.hpp
  42. 37 61
      src/entt/meta/node.hpp
  43. 6 18
      src/entt/meta/pointer.hpp
  44. 1 8
      src/entt/meta/policy.hpp
  45. 4 11
      src/entt/meta/range.hpp
  46. 1 9
      src/entt/meta/resolve.hpp
  47. 1 7
      src/entt/meta/template.hpp
  48. 1 11
      src/entt/meta/type_traits.hpp
  49. 32 58
      src/entt/meta/utility.hpp
  50. 9 28
      src/entt/platform/android-ndk-r17.hpp
  51. 1 7
      src/entt/poly/fwd.hpp
  52. 25 37
      src/entt/poly/poly.hpp
  53. 14 22
      src/entt/process/process.hpp
  54. 10 16
      src/entt/process/scheduler.hpp
  55. 7 12
      src/entt/resource/cache.hpp
  56. 1 7
      src/entt/resource/fwd.hpp
  57. 14 22
      src/entt/resource/handle.hpp
  58. 2 7
      src/entt/resource/loader.hpp
  59. 15 38
      src/entt/signal/delegate.hpp
  60. 10 15
      src/entt/signal/dispatcher.hpp
  61. 8 14
      src/entt/signal/emitter.hpp
  62. 1 11
      src/entt/signal/fwd.hpp
  63. 13 28
      src/entt/signal/sigh.hpp
  64. 39 47
      test/benchmark/benchmark.cpp
  65. 6 6
      test/entt/core/algorithm.cpp
  66. 20 11
      test/entt/core/any.cpp
  67. 12 8
      test/entt/core/compressed_pair.cpp
  68. 1 2
      test/entt/core/enum.cpp
  69. 1 1
      test/entt/core/memory.cpp
  70. 15 15
      test/entt/core/tuple.cpp
  71. 3 3
      test/entt/core/type_info.cpp
  72. 9 3
      test/entt/core/type_traits.cpp
  73. 8 9
      test/entt/core/utility.cpp
  74. 6 4
      test/entt/entity/group.cpp
  75. 3 3
      test/entt/entity/handle.cpp
  76. 5 3
      test/entt/entity/helper.cpp
  77. 9 5
      test/entt/entity/observer.cpp
  78. 4 9
      test/entt/entity/poly_storage.cpp
  79. 41 39
      test/entt/entity/registry.cpp
  80. 14 12
      test/entt/entity/runtime_view.cpp
  81. 6 2
      test/entt/entity/sigh_storage_mixin.cpp
  82. 37 44
      test/entt/entity/snapshot.cpp
  83. 19 17
      test/entt/entity/sparse_set.cpp
  84. 29 24
      test/entt/entity/storage.cpp
  85. 4 9
      test/entt/entity/throwing_allocator.hpp
  86. 4 10
      test/entt/entity/throwing_component.hpp
  87. 6 4
      test/entt/entity/view.cpp
  88. 5 2
      test/entt/locator/locator.cpp
  89. 17 12
      test/entt/meta/meta_any.cpp
  90. 3 1
      test/entt/meta/meta_conv.cpp
  91. 14 10
      test/entt/meta/meta_ctor.cpp
  92. 17 10
      test/entt/meta/meta_data.cpp
  93. 16 10
      test/entt/meta/meta_func.cpp
  94. 8 3
      test/entt/meta/meta_handle.cpp
  95. 26 15
      test/entt/meta/meta_pointer.cpp
  96. 17 14
      test/entt/meta/meta_type.cpp
  97. 42 19
      test/entt/poly/poly_deduced.cpp
  98. 46 24
      test/entt/poly/poly_defined.cpp
  99. 25 10
      test/entt/process/process.cpp
  100. 10 8
      test/entt/process/scheduler.cpp

+ 41 - 0
.clang-format

@@ -0,0 +1,41 @@
+BasedOnStyle: llvm
+---
+AccessModifierOffset: -4
+AlignEscapedNewlines: DontAlign
+AllowShortBlocksOnASingleLine: Empty
+AllowShortEnumsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: WithoutElse
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakTemplateDeclarations: Yes
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeTernaryOperators: true
+ColumnLimit: 0
+DerivePointerAlignment: false
+IncludeCategories:
+  - Regex: '<[[:alnum:]_]+>'
+    Priority: 1
+  - Regex: '<(gtest|gmock)/'
+    Priority: 2
+  - Regex: '<[[:alnum:]_./]+>'
+    Priority: 3
+  - Regex: '<entt/'
+    Priority: 4
+  - Regex: '.*'
+    Priority: 5
+IndentPPDirectives: AfterHash
+IndentWidth: 4
+KeepEmptyLinesAtTheStartOfBlocks: false
+Language: Cpp
+PointerAlignment: Right
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: false
+SpaceAroundPointerQualifiers: After
+SpaceBeforeCaseColon: false
+SpaceBeforeCtorInitializerColon: false
+SpaceBeforeInheritanceColon: false
+SpaceBeforeParens: Never
+SpaceBeforeRangeBasedForLoopColon: false
+Standard: Latest
+TabWidth: 4
+UseTab: Never

+ 33 - 43
src/entt/config/config.h

@@ -1,81 +1,71 @@
 #ifndef ENTT_CONFIG_CONFIG_H
 #define ENTT_CONFIG_CONFIG_H
 
-
 #if defined(__cpp_exceptions) && !defined(ENTT_NOEXCEPTION)
-#   define ENTT_NOEXCEPT noexcept
-#   define ENTT_THROW throw
-#   define ENTT_TRY try
-#   define ENTT_CATCH catch(...)
+#    define ENTT_NOEXCEPT noexcept
+#    define ENTT_THROW throw
+#    define ENTT_TRY try
+#    define ENTT_CATCH catch(...)
 #else
-#   define ENTT_NOEXCEPT
-#   define ENTT_THROW
-#   define ENTT_TRY if(true)
-#   define ENTT_CATCH if(false)
+#    define ENTT_NOEXCEPT
+#    define ENTT_THROW
+#    define ENTT_TRY if(true)
+#    define ENTT_CATCH if(false)
 #endif
 
-
 #if defined(__cpp_lib_launder) && __cpp_lib_launder >= 201606L
-#   include <new>
-#   define ENTT_LAUNDER(expr) std::launder(expr)
+#    include <new>
+#    define ENTT_LAUNDER(expr) std::launder(expr)
 #else
-#   define ENTT_LAUNDER(expr) expr
+#    define ENTT_LAUNDER(expr) expr
 #endif
 
-
 #ifndef ENTT_USE_ATOMIC
-#   define ENTT_MAYBE_ATOMIC(Type) Type
+#    define ENTT_MAYBE_ATOMIC(Type) Type
 #else
-#   include <atomic>
-#   define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>
+#    include <atomic>
+#    define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>
 #endif
 
-
 #ifndef ENTT_ID_TYPE
-#   include <cstdint>
-#   define ENTT_ID_TYPE std::uint32_t
+#    include <cstdint>
+#    define ENTT_ID_TYPE std::uint32_t
 #endif
 
-
 #ifndef ENTT_SPARSE_PAGE
-#   define ENTT_SPARSE_PAGE 4096
+#    define ENTT_SPARSE_PAGE 4096
 #endif
 
-
 #ifndef ENTT_PACKED_PAGE
-#   define ENTT_PACKED_PAGE 1024
+#    define ENTT_PACKED_PAGE 1024
 #endif
 
-
 #ifdef ENTT_DISABLE_ASSERT
-#   undef ENTT_ASSERT
-#   define ENTT_ASSERT(...) (void(0))
+#    undef ENTT_ASSERT
+#    define ENTT_ASSERT(...) (void(0))
 #elif !defined ENTT_ASSERT
-#   include <cassert>
-#   define ENTT_ASSERT(condition, ...) assert(condition)
+#    include <cassert>
+#    define ENTT_ASSERT(condition, ...) assert(condition)
 #endif
 
-
 #ifdef ENTT_NO_ETO
-#   include <type_traits>
-#   define ENTT_IGNORE_IF_EMPTY std::false_type
+#    include <type_traits>
+#    define ENTT_IGNORE_IF_EMPTY std::false_type
 #else
-#   include <type_traits>
-#   define ENTT_IGNORE_IF_EMPTY std::true_type
+#    include <type_traits>
+#    define ENTT_IGNORE_IF_EMPTY std::true_type
 #endif
 
-
 #ifndef ENTT_STANDARD_CPP
 #    if defined __clang__ || defined __GNUC__
-#       define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
-#       define ENTT_PRETTY_FUNCTION_PREFIX '='
-#       define ENTT_PRETTY_FUNCTION_SUFFIX ']'
+#        define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#        define ENTT_PRETTY_FUNCTION_PREFIX '='
+#        define ENTT_PRETTY_FUNCTION_SUFFIX ']'
 #    elif defined _MSC_VER
-#       define ENTT_PRETTY_FUNCTION __FUNCSIG__
-#       define ENTT_PRETTY_FUNCTION_PREFIX '<'
-#       define ENTT_PRETTY_FUNCTION_SUFFIX '>'
-#   endif
+#        define ENTT_PRETTY_FUNCTION __FUNCSIG__
+#        define ENTT_PRETTY_FUNCTION_PREFIX '<'
+#        define ENTT_PRETTY_FUNCTION_SUFFIX '>'
+#    endif
 #endif
 
-
 #endif

+ 0 - 2
src/entt/config/version.h

@@ -1,10 +1,8 @@
 #ifndef ENTT_CONFIG_VERSION_H
 #define ENTT_CONFIG_VERSION_H
 
-
 #define ENTT_VERSION_MAJOR 3
 #define ENTT_VERSION_MINOR 9
 #define ENTT_VERSION_PATCH 0
 
-
 #endif

+ 7 - 14
src/entt/core/algorithm.hpp

@@ -1,18 +1,15 @@
 #ifndef ENTT_CORE_ALGORITHM_HPP
 #define ENTT_CORE_ALGORITHM_HPP
 
-
-#include <vector>
-#include <utility>
-#include <iterator>
 #include <algorithm>
 #include <functional>
+#include <iterator>
+#include <utility>
+#include <vector>
 #include "utility.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Function object to wrap `std::sort` in a class type.
  *
@@ -36,12 +33,11 @@ struct std_sort {
      * @param args Arguments to forward to the sort function, if any.
      */
     template<typename It, typename Compare = std::less<>, typename... Args>
-    void operator()(It first, It last, Compare compare = Compare{}, Args &&... args) const {
+    void operator()(It first, It last, Compare compare = Compare{}, Args &&...args) const {
         std::sort(std::forward<Args>(args)..., std::move(first), std::move(last), std::move(compare));
     }
 };
 
-
 /*! @brief Function object for performing insertion sort. */
 struct insertion_sort {
     /**
@@ -62,8 +58,8 @@ struct insertion_sort {
                 auto value = std::move(*it);
                 auto pre = it;
 
-                for(; pre > first && compare(value, *(pre-1)); --pre) {
-                    *pre = std::move(*(pre-1));
+                for(; pre > first && compare(value, *(pre - 1)); --pre) {
+                    *pre = std::move(*(pre - 1));
                 }
 
                 *pre = std::move(value);
@@ -72,7 +68,6 @@ struct insertion_sort {
     }
 };
 
-
 /**
  * @brief Function object for performing LSD radix sort.
  * @tparam Bit Number of bits processed per pass.
@@ -137,8 +132,6 @@ struct radix_sort {
     }
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 43 - 53
src/entt/core/any.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_CORE_ANY_HPP
 #define ENTT_CORE_ANY_HPP
 
-
 #include <cstddef>
 #include <memory>
 #include <type_traits>
@@ -12,10 +11,8 @@
 #include "type_info.hpp"
 #include "type_traits.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief A SBO friendly, type-safe container for single values of any type.
  * @tparam Len Size of the storage reserved for the small buffer optimization.
@@ -23,12 +20,19 @@ 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 operation : std::uint8_t {
+        COPY,
+        MOVE,
+        DTOR,
+        COMP,
+        GET,
+        TYPE
     };
 
-    enum class policy: std::uint8_t {
-        OWNER, REF, CREF
+    enum class policy : std::uint8_t {
+        OWNER,
+        REF,
+        CREF
     };
 
     using storage_type = std::aligned_storage_t<Len + !Len, Align>;
@@ -38,7 +42,7 @@ class basic_any {
     static constexpr bool in_situ = Len && alignof(Type) <= alignof(storage_type) && sizeof(Type) <= sizeof(storage_type) && std::is_nothrow_move_constructible_v<Type>;
 
     template<typename Type>
-    static const void * basic_vtable([[maybe_unused]] const operation op, [[maybe_unused]] const basic_any &from, [[maybe_unused]] const void *to) {
+    static const void *basic_vtable([[maybe_unused]] const operation op, [[maybe_unused]] const basic_any &from, [[maybe_unused]] const void *to) {
         static_assert(!std::is_same_v<Type, void> && std::is_same_v<std::remove_reference_t<std::remove_const_t<Type>>, Type>, "Invalid type");
         const Type *instance = nullptr;
 
@@ -47,7 +51,7 @@ class basic_any {
         } else {
             instance = static_cast<const Type *>(from.instance);
         }
-        
+
         switch(op) {
         case operation::COPY:
             if constexpr(std::is_copy_constructible_v<Type>) {
@@ -57,10 +61,10 @@ class basic_any {
         case operation::MOVE:
             if constexpr(in_situ<Type>) {
                 if(from.mode == policy::OWNER) {
-                    return new (&static_cast<basic_any *>(const_cast<void *>(to))->storage) Type{std::move(*const_cast<Type *>(instance))};
+                    return new(&static_cast<basic_any *>(const_cast<void *>(to))->storage) Type{std::move(*const_cast<Type *>(instance))};
                 }
             }
-        
+
             return (static_cast<basic_any *>(const_cast<void *>(to))->instance = std::exchange(const_cast<basic_any &>(from).instance, nullptr));
         case operation::DTOR:
             if constexpr(in_situ<Type>) {
@@ -71,8 +75,7 @@ class basic_any {
                 delete instance;
             }
             break;
-        case operation::COMP:
-        {
+        case operation::COMP: {
             const auto info = type_id<Type>();
             auto *value = static_cast<const basic_any *>(to)->data(&info);
 
@@ -93,7 +96,7 @@ class basic_any {
     }
 
     template<typename Type, typename... Args>
-    void initialize([[maybe_unused]] Args &&... args) {
+    void initialize([[maybe_unused]] Args &&...args) {
         if constexpr(!std::is_void_v<Type>) {
             vtable = basic_vtable<std::remove_const_t<std::remove_reference_t<Type>>>;
 
@@ -103,9 +106,9 @@ class basic_any {
                 instance = (std::addressof(args), ...);
             } else if constexpr(in_situ<Type>) {
                 if constexpr(sizeof...(Args) != 0u && std::is_aggregate_v<Type>) {
-                    new (&storage) Type{std::forward<Args>(args)...};
+                    new(&storage) Type{std::forward<Args>(args)...};
                 } else {
-                    new (&storage) Type(std::forward<Args>(args)...);
+                    new(&storage) Type(std::forward<Args>(args)...);
                 }
             } else {
                 if constexpr(sizeof...(Args) != 0u && std::is_aggregate_v<Type>) {
@@ -120,8 +123,7 @@ class basic_any {
     basic_any(const basic_any &other, const policy pol) ENTT_NOEXCEPT
         : instance{other.data()},
           vtable{other.vtable},
-          mode{pol}
-    {}
+          mode{pol} {}
 
 public:
     /*! @brief Size of the internal storage. */
@@ -133,8 +135,7 @@ public:
     basic_any() ENTT_NOEXCEPT
         : instance{},
           vtable{},
-          mode{policy::OWNER}
-    {}
+          mode{policy::OWNER} {}
 
     /**
      * @brief Constructs a wrapper by directly initializing the new object.
@@ -143,9 +144,8 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    explicit basic_any(std::in_place_type_t<Type>, Args &&... args)
-        : basic_any{}
-    {
+    explicit basic_any(std::in_place_type_t<Type>, Args &&...args)
+        : basic_any{} {
         initialize<Type>(std::forward<Args>(args)...);
     }
 
@@ -156,8 +156,7 @@ public:
      */
     template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Type>, basic_any>>>
     basic_any(Type &&value)
-        : basic_any{}
-    {
+        : basic_any{} {
         initialize<std::decay_t<Type>>(std::forward<Type>(value));
     }
 
@@ -166,8 +165,7 @@ public:
      * @param other The instance to copy from.
      */
     basic_any(const basic_any &other)
-        : basic_any{}
-    {
+        : basic_any{} {
         if(other.vtable) {
             other.vtable(operation::COPY, other, this);
         }
@@ -180,8 +178,7 @@ public:
     basic_any(basic_any &&other) ENTT_NOEXCEPT
         : instance{},
           vtable{other.vtable},
-          mode{other.mode}
-    {
+          mode{other.mode} {
         if(other.vtable) {
             other.vtable(operation::MOVE, other, this);
         }
@@ -199,7 +196,7 @@ public:
      * @param other The instance to copy from.
      * @return This any object.
      */
-    basic_any & operator=(const basic_any &other) {
+    basic_any &operator=(const basic_any &other) {
         reset();
 
         if(other.vtable) {
@@ -214,7 +211,7 @@ public:
      * @param other The instance to move from.
      * @return This any object.
      */
-    basic_any & operator=(basic_any &&other) ENTT_NOEXCEPT {
+    basic_any &operator=(basic_any &&other) ENTT_NOEXCEPT {
         reset();
 
         if(other.vtable) {
@@ -258,12 +255,12 @@ public:
      * @param req Optional expected type.
      * @return An opaque pointer the contained instance, if any.
      */
-    [[nodiscard]] const void * data(const type_info *req = nullptr) const ENTT_NOEXCEPT {
+    [[nodiscard]] const void *data(const type_info *req = nullptr) const ENTT_NOEXCEPT {
         return vtable ? vtable(operation::GET, *this, req) : nullptr;
     }
 
     /*! @copydoc data */
-    [[nodiscard]] void * data(const type_info *req = nullptr) ENTT_NOEXCEPT {
+    [[nodiscard]] void *data(const type_info *req = nullptr) ENTT_NOEXCEPT {
         return (!vtable || mode == policy::CREF) ? nullptr : const_cast<void *>(vtable(operation::GET, *this, req));
     }
 
@@ -274,7 +271,7 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    void emplace(Args &&... args) {
+    void emplace(Args &&...args) {
         reset();
         initialize<Type>(std::forward<Args>(args)...);
     }
@@ -332,12 +329,14 @@ public:
     }
 
 private:
-    union { const void *instance; storage_type storage; };
+    union {
+        const void *instance;
+        storage_type storage;
+    };
     vtable_type *vtable;
     policy mode;
 };
 
-
 /**
  * @brief Checks if two wrappers differ in their content.
  * @tparam Len Size of the storage reserved for the small buffer optimization.
@@ -351,7 +350,6 @@ template<std::size_t Len, std::size_t Align>
     return !(lhs == rhs);
 }
 
-
 /**
  * @brief Performs type-safe access to the contained object.
  * @tparam Type Type to which conversion is required.
@@ -362,56 +360,51 @@ template<std::size_t Len, std::size_t Align>
  */
 template<typename Type, std::size_t Len, std::size_t Align>
 Type any_cast(const basic_any<Len, Align> &data) ENTT_NOEXCEPT {
-    const auto * const instance = any_cast<std::remove_reference_t<Type>>(&data);
+    const auto *const instance = any_cast<std::remove_reference_t<Type>>(&data);
     ENTT_ASSERT(instance, "Invalid instance");
     return static_cast<Type>(*instance);
 }
 
-
 /*! @copydoc any_cast */
 template<typename Type, std::size_t Len, std::size_t Align>
 Type any_cast(basic_any<Len, Align> &data) ENTT_NOEXCEPT {
     // forces const on non-reference types to make them work also with wrappers for const references
-    auto * const instance = any_cast<std::remove_reference_t<const Type>>(&data);
+    auto *const instance = any_cast<std::remove_reference_t<const Type>>(&data);
     ENTT_ASSERT(instance, "Invalid instance");
     return static_cast<Type>(*instance);
 }
 
-
 /*! @copydoc any_cast */
 template<typename Type, std::size_t Len, std::size_t Align>
 Type any_cast(basic_any<Len, Align> &&data) ENTT_NOEXCEPT {
     if constexpr(std::is_copy_constructible_v<std::remove_const_t<std::remove_reference_t<Type>>>) {
-        if(auto * const instance = any_cast<std::remove_reference_t<Type>>(&data); instance) {
+        if(auto *const instance = any_cast<std::remove_reference_t<Type>>(&data); instance) {
             return static_cast<Type>(std::move(*instance));
         } else {
             return any_cast<Type>(data);
         }
     } else {
-        auto * const instance = any_cast<std::remove_reference_t<Type>>(&data);
+        auto *const instance = any_cast<std::remove_reference_t<Type>>(&data);
         ENTT_ASSERT(instance, "Invalid instance");
         return static_cast<Type>(std::move(*instance));
     }
 }
 
-
 /*! @copydoc any_cast */
 template<typename Type, std::size_t Len, std::size_t Align>
-const Type * any_cast(const basic_any<Len, Align> *data) ENTT_NOEXCEPT {
+const Type *any_cast(const basic_any<Len, Align> *data) ENTT_NOEXCEPT {
     const auto info = type_id<std::remove_const_t<std::remove_reference_t<Type>>>();
     return static_cast<const Type *>(data->data(&info));
 }
 
-
 /*! @copydoc any_cast */
 template<typename Type, std::size_t Len, std::size_t Align>
-Type * any_cast(basic_any<Len, Align> *data) ENTT_NOEXCEPT {
+Type *any_cast(basic_any<Len, Align> *data) ENTT_NOEXCEPT {
     const auto info = type_id<std::remove_const_t<std::remove_reference_t<Type>>>();
     // last attempt to make wrappers for const references return their values
     return static_cast<Type *>(static_cast<constness_as_t<basic_any<Len, Align>, Type> *>(data)->data(&info));
 }
 
-
 /**
  * @brief Constructs a wrapper from a given type, passing it all arguments.
  * @tparam Type Type of object to use to initialize the wrapper.
@@ -422,11 +415,10 @@ Type * any_cast(basic_any<Len, Align> *data) ENTT_NOEXCEPT {
  * @return A properly initialized wrapper for an object of the given type.
  */
 template<typename Type, std::size_t Len = basic_any<>::length, std::size_t Align = basic_any<Len>::alignment, typename... Args>
-basic_any<Len, Align> make_any(Args &&... args) {
+basic_any<Len, Align> make_any(Args &&...args) {
     return basic_any<Len, Align>{std::in_place_type<Type>, std::forward<Args>(args)...};
 }
 
-
 /**
  * @brief Forwards its argument and avoids copies for lvalue references.
  * @tparam Len Size of the storage reserved for the small buffer optimization.
@@ -440,8 +432,6 @@ basic_any<Len, Align> forward_as_any(Type &&value) {
     return basic_any<Len, Align>{std::in_place_type<std::conditional_t<std::is_rvalue_reference_v<Type>, std::decay_t<Type>, Type>>, std::forward<Type>(value)};
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 20 - 23
src/entt/core/attribute.h

@@ -1,33 +1,30 @@
 #ifndef ENTT_CORE_ATTRIBUTE_H
 #define ENTT_CORE_ATTRIBUTE_H
 
-
 #ifndef ENTT_EXPORT
-#   if defined _WIN32 || defined __CYGWIN__ || defined _MSC_VER
-#       define ENTT_EXPORT __declspec(dllexport)
-#       define ENTT_IMPORT __declspec(dllimport)
-#       define ENTT_HIDDEN
-#   elif defined __GNUC__ && __GNUC__ >= 4
-#       define ENTT_EXPORT __attribute__((visibility("default")))
-#       define ENTT_IMPORT __attribute__((visibility("default")))
-#       define ENTT_HIDDEN __attribute__((visibility("hidden")))
-#   else /* Unsupported compiler */
-#       define ENTT_EXPORT
-#       define ENTT_IMPORT
-#       define ENTT_HIDDEN
-#   endif
+#    if defined _WIN32 || defined __CYGWIN__ || defined _MSC_VER
+#        define ENTT_EXPORT __declspec(dllexport)
+#        define ENTT_IMPORT __declspec(dllimport)
+#        define ENTT_HIDDEN
+#    elif defined __GNUC__ && __GNUC__ >= 4
+#        define ENTT_EXPORT __attribute__((visibility("default")))
+#        define ENTT_IMPORT __attribute__((visibility("default")))
+#        define ENTT_HIDDEN __attribute__((visibility("hidden")))
+#    else /* Unsupported compiler */
+#        define ENTT_EXPORT
+#        define ENTT_IMPORT
+#        define ENTT_HIDDEN
+#    endif
 #endif
 
-
 #ifndef ENTT_API
-#   if defined ENTT_API_EXPORT
-#       define ENTT_API ENTT_EXPORT
-#   elif defined ENTT_API_IMPORT
-#       define ENTT_API ENTT_IMPORT
-#   else /* No API */
-#       define ENTT_API
-#   endif
+#    if defined ENTT_API_EXPORT
+#        define ENTT_API ENTT_EXPORT
+#    elif defined ENTT_API_IMPORT
+#        define ENTT_API ENTT_IMPORT
+#    else /* No API */
+#        define ENTT_API
+#    endif
 #endif
 
-
 #endif

+ 33 - 54
src/entt/core/compressed_pair.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_CORE_COMPRESSED_PAIR_HPP
 #define ENTT_CORE_COMPRESSED_PAIR_HPP
 
-
 #include <cstddef>
 #include <tuple>
 #include <type_traits>
@@ -9,41 +8,34 @@
 #include "../config/config.h"
 #include "type_traits.hpp"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename Type, std::size_t, typename = void>
 struct compressed_pair_element {
     template<bool Dummy = true, typename = std::enable_if_t<Dummy && std::is_default_constructible_v<Type>>>
     compressed_pair_element()
-        : value{}
-    {}
+        : value{} {}
 
     template<typename Args, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Args>, compressed_pair_element>>>
     compressed_pair_element(Args &&args)
-        : value{std::forward<Args>(args)}
-    {}
+        : value{std::forward<Args>(args)} {}
 
     template<typename... Args, std::size_t... Index>
     compressed_pair_element(std::tuple<Args...> args, std::index_sequence<Index...>)
-        : value{std::get<Index>(args)...}
-    {}
+        : value{std::get<Index>(args)...} {}
 
-    [[nodiscard]] Type & get() ENTT_NOEXCEPT {
+    [[nodiscard]] Type &get() ENTT_NOEXCEPT {
         return value;
     }
 
-    [[nodiscard]] const Type & get() const ENTT_NOEXCEPT {
+    [[nodiscard]] const Type &get() const ENTT_NOEXCEPT {
         return value;
     }
 
@@ -51,43 +43,36 @@ private:
     Type value;
 };
 
-
 template<typename Type, std::size_t Tag>
 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{}
-    {}
+        : Type{} {}
 
     template<typename Args, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Args>, compressed_pair_element>>>
     compressed_pair_element(Args &&args)
-        : Type{std::forward<Args>(args)}
-    {}
+        : Type{std::forward<Args>(args)} {}
 
     template<typename... Args, std::size_t... Index>
     compressed_pair_element(std::tuple<Args...> args, std::index_sequence<Index...>)
-        : Type{std::get<Index>(args)...}
-    {}
+        : Type{std::get<Index>(args)...} {}
 
-    [[nodiscard]] Type & get() ENTT_NOEXCEPT {
+    [[nodiscard]] Type &get() ENTT_NOEXCEPT {
         return *this;
     }
 
-    [[nodiscard]] const Type & get() const ENTT_NOEXCEPT {
+    [[nodiscard]] const Type &get() const ENTT_NOEXCEPT {
         return *this;
     }
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief A compressed pair.
  *
@@ -99,8 +84,8 @@ struct compressed_pair_element<Type, Tag, std::enable_if_t<is_ebco_eligible_v<Ty
  */
 template<typename First, typename Second>
 class compressed_pair final
-    : internal::compressed_pair_element<First, 0u>, internal::compressed_pair_element<Second, 1u>
-{
+    : 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>;
 
@@ -116,8 +101,7 @@ public:
     template<bool Dummy = true, typename = std::enable_if_t<Dummy && std::is_default_constructible_v<First> && std::is_default_constructible_v<Second>>>
     constexpr compressed_pair()
         : first_base{},
-          second_base{}
-    {}
+          second_base{} {}
 
     /**
      * @brief Copy constructor.
@@ -141,8 +125,7 @@ public:
     template<typename Arg, typename Other>
     constexpr compressed_pair(Arg &&arg, Other &&other)
         : first_base{std::forward<Arg>(arg)},
-          second_base{std::forward<Other>(other)}
-    {}
+          second_base{std::forward<Other>(other)} {}
 
     /**
      * @brief Constructs a pair by forwarding the arguments to its parts.
@@ -154,33 +137,32 @@ public:
     template<typename... Args, typename... Other>
     constexpr compressed_pair(std::piecewise_construct_t, std::tuple<Args...> args, std::tuple<Other...> other)
         : first_base{std::move(args), std::index_sequence_for<Args...>{}},
-          second_base{std::move(other), std::index_sequence_for<Other...>{}}
-    {}
+          second_base{std::move(other), std::index_sequence_for<Other...>{}} {}
 
     /**
      * @brief Copy assignment operator.
      * @param other The instance to copy from.
      * @return This compressed pair object.
      */
-    constexpr compressed_pair & operator=(const compressed_pair &other) = default;
+    constexpr compressed_pair &operator=(const compressed_pair &other) = default;
 
     /**
      * @brief Move assignment operator.
      * @param other The instance to move from.
      * @return This compressed pair object.
      */
-    constexpr compressed_pair & operator=(compressed_pair &&other) ENTT_NOEXCEPT = default;
+    constexpr compressed_pair &operator=(compressed_pair &&other) ENTT_NOEXCEPT = default;
 
     /**
      * @brief Returns the first element that a pair stores.
      * @return The first element that a pair stores.
      */
-    [[nodiscard]] First & first() ENTT_NOEXCEPT {
+    [[nodiscard]] First &first() ENTT_NOEXCEPT {
         return static_cast<first_base &>(*this).get();
     }
 
     /*! @copydoc first */
-    [[nodiscard]] const First & first() const ENTT_NOEXCEPT {
+    [[nodiscard]] const First &first() const ENTT_NOEXCEPT {
         return static_cast<const first_base &>(*this).get();
     }
 
@@ -188,12 +170,12 @@ public:
      * @brief Returns the second element that a pair stores.
      * @return The second element that a pair stores.
      */
-    [[nodiscard]] Second & second() ENTT_NOEXCEPT {
+    [[nodiscard]] Second &second() ENTT_NOEXCEPT {
         return static_cast<second_base &>(*this).get();
     }
 
     /*! @copydoc second */
-    [[nodiscard]] const Second & second() const ENTT_NOEXCEPT {
+    [[nodiscard]] const Second &second() const ENTT_NOEXCEPT {
         return static_cast<const second_base &>(*this).get();
     }
 
@@ -235,7 +217,6 @@ public:
     }
 };
 
-
 /**
  * @brief Deduction guide.
  * @tparam Type Type of value to use to initialize the first element.
@@ -244,7 +225,6 @@ public:
 template<typename Type, typename Other>
 compressed_pair(Type &&, Other &&) -> compressed_pair<std::decay_t<Type>, std::decay_t<Other>>;
 
-
 /**
  * @brief Swaps two compressed pair objects.
  * @tparam First The type of the first element that the pairs store.
@@ -257,22 +237,21 @@ inline void swap(compressed_pair<First, Second> &lhs, compressed_pair<First, Sec
     lhs.swap(rhs);
 }
 
+} // namespace entt
 
-}
-
-
-namespace std {
 // disable structured binding support for clang 6, it messes when specializing tuple_size
 #if !defined __clang_major__ || __clang_major__ > 6
-    template<typename First, typename Second>
-    struct tuple_size<entt::compressed_pair<First, Second>>: integral_constant<size_t, 2u> {};
+namespace std {
 
-    template<size_t Index, typename First, typename Second>
-    struct tuple_element<Index, entt::compressed_pair<First, Second>>: conditional<Index == 0u, First, Second> {
-        static_assert(Index < 2u, "Index out of bounds");
-    };
-#endif
-}
+template<typename First, typename Second>
+struct tuple_size<entt::compressed_pair<First, Second>>: integral_constant<size_t, 2u> {};
 
+template<size_t Index, typename First, typename Second>
+struct tuple_element<Index, entt::compressed_pair<First, Second>>: conditional<Index == 0u, First, Second> {
+    static_assert(Index < 2u, "Index out of bounds");
+};
+
+} // namespace std
+#endif
 
 #endif

+ 1 - 18
src/entt/core/enum.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_CORE_FLAG_HPP
 #define ENTT_CORE_FLAG_HPP
 
-
 #include <type_traits>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /**
  * @brief Enable bitmask support for enum classes.
  * @tparam Type The enum type for which to enable bitmask support.
@@ -16,12 +13,10 @@ namespace entt {
 template<typename Type, typename = void>
 struct enum_as_bitmask: std::false_type {};
 
-
 /*! @copydoc enum_as_bitmask */
 template<typename Type>
 struct enum_as_bitmask<Type, std::void_t<decltype(Type::_entt_enum_as_bitmask)>>: std::true_type {};
 
-
 /**
  * @brief Helper variable template.
  * @tparam Type The enum class type for which to enable bitmask support.
@@ -29,9 +24,7 @@ struct enum_as_bitmask<Type, std::void_t<decltype(Type::_entt_enum_as_bitmask)>>
 template<typename Type>
 inline constexpr bool enum_as_bitmask_v = enum_as_bitmask<Type>::value;
 
-
-}
-
+} // namespace entt
 
 /**
  * @brief Operator available for enums for which bitmask support is enabled.
@@ -47,7 +40,6 @@ operator|(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
     return Type{static_cast<std::underlying_type_t<Type>>(lhs) | static_cast<std::underlying_type_t<Type>>(rhs)};
 }
 
-
 /*! @copydoc operator| */
 template<typename Type>
 [[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
@@ -55,7 +47,6 @@ operator&(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
     return Type{static_cast<std::underlying_type_t<Type>>(lhs) & static_cast<std::underlying_type_t<Type>>(rhs)};
 }
 
-
 /*! @copydoc operator| */
 template<typename Type>
 [[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
@@ -63,7 +54,6 @@ operator^(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
     return Type{static_cast<std::underlying_type_t<Type>>(lhs) ^ static_cast<std::underlying_type_t<Type>>(rhs)};
 }
 
-
 /**
  * @brief Operator available for enums for which bitmask support is enabled.
  * @tparam Type Enum class type.
@@ -77,7 +67,6 @@ operator~(const Type value) ENTT_NOEXCEPT {
     return Type{~static_cast<std::underlying_type_t<Type>>(value)};
 }
 
-
 /*! @copydoc operator~ */
 template<typename Type>
 [[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, bool>
@@ -85,7 +74,6 @@ operator!(const Type value) ENTT_NOEXCEPT {
     return !static_cast<std::underlying_type_t<Type>>(value);
 }
 
-
 /*! @copydoc operator| */
 template<typename Type>
 constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type &>
@@ -93,7 +81,6 @@ operator|=(Type &lhs, const Type rhs) ENTT_NOEXCEPT {
     return (lhs = (lhs | rhs));
 }
 
-
 /*! @copydoc operator| */
 template<typename Type>
 constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type &>
@@ -101,7 +88,6 @@ operator&=(Type &lhs, const Type rhs) ENTT_NOEXCEPT {
     return (lhs = (lhs & rhs));
 }
 
-
 /*! @copydoc operator| */
 template<typename Type>
 constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type &>
@@ -109,7 +95,6 @@ operator^=(Type &lhs, const Type rhs) ENTT_NOEXCEPT {
     return (lhs = (lhs ^ rhs));
 }
 
-
 /*! @copydoc operator| */
 template<typename Type>
 [[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
@@ -117,7 +102,6 @@ operator==(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
     return (static_cast<std::underlying_type_t<Type>>(lhs) == static_cast<std::underlying_type_t<Type>>(rhs));
 }
 
-
 /*! @copydoc operator| */
 template<typename Type>
 [[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
@@ -125,5 +109,4 @@ operator!=(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
     return !(lhs == rhs);
 }
 
-
 #endif

+ 1 - 6
src/entt/core/family.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_CORE_FAMILY_HPP
 #define ENTT_CORE_FAMILY_HPP
 
-
 #include "../config/config.h"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Dynamic identifier generator.
  *
@@ -30,8 +27,6 @@ public:
     inline static const family_type type = identifier++;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 8
src/entt/core/fwd.hpp

@@ -1,27 +1,20 @@
 #ifndef ENTT_CORE_FWD_HPP
 #define ENTT_CORE_FWD_HPP
 
-
 #include <type_traits>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 template<std::size_t Len = sizeof(double[2]), std::size_t = alignof(typename std::aligned_storage_t<Len + !Len>)>
 class basic_any;
 
-
 /*! @brief Alias declaration for type identifiers. */
 using id_type = ENTT_ID_TYPE;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using any = basic_any<>;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 16 - 37
src/entt/core/hashed_string.hpp

@@ -1,29 +1,23 @@
 #ifndef ENTT_CORE_HASHED_STRING_HPP
 #define ENTT_CORE_HASHED_STRING_HPP
 
-
 #include <cstddef>
 #include <cstdint>
 #include "../config/config.h"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename>
 struct fnv1a_traits;
 
-
 template<>
 struct fnv1a_traits<std::uint32_t> {
     using type = std::uint32_t;
@@ -31,7 +25,6 @@ struct fnv1a_traits<std::uint32_t> {
     static constexpr std::uint32_t prime = 16777619;
 };
 
-
 template<>
 struct fnv1a_traits<std::uint64_t> {
     using type = std::uint64_t;
@@ -39,16 +32,13 @@ struct fnv1a_traits<std::uint64_t> {
     static constexpr std::uint64_t prime = 1099511628211ull;
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Zero overhead unique identifier.
  *
@@ -130,8 +120,8 @@ public:
 
     /*! @brief Constructs an empty hashed string. */
     constexpr basic_hashed_string() ENTT_NOEXCEPT
-        : str{nullptr}, hash{}
-    {}
+        : str{nullptr},
+          hash{} {}
 
     /**
      * @brief Constructs a hashed string from an array of const characters.
@@ -149,8 +139,8 @@ public:
      */
     template<std::size_t N>
     constexpr basic_hashed_string(const value_type (&curr)[N]) ENTT_NOEXCEPT
-        : str{curr}, hash{helper(curr)}
-    {}
+        : str{curr},
+          hash{helper(curr)} {}
 
     /**
      * @brief Explicit constructor on purpose to avoid constructing a hashed
@@ -158,14 +148,14 @@ public:
      * @param wrapper Helps achieving the purpose by relying on overloading.
      */
     explicit constexpr basic_hashed_string(const_wrapper wrapper) ENTT_NOEXCEPT
-        : str{wrapper.str}, hash{helper(wrapper.str)}
-    {}
+        : str{wrapper.str},
+          hash{helper(wrapper.str)} {}
 
     /**
      * @brief Returns the human-readable representation of a hashed string.
      * @return The string used to initialize the instance.
      */
-    [[nodiscard]] constexpr const value_type * data() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr const value_type *data() const ENTT_NOEXCEPT {
         return str;
     }
 
@@ -178,20 +168,23 @@ public:
     }
 
     /*! @copydoc data */
-    [[nodiscard]] constexpr operator const value_type *() const ENTT_NOEXCEPT { return data(); }
+    [[nodiscard]] constexpr operator const value_type *() const ENTT_NOEXCEPT {
+        return data();
+    }
 
     /**
      * @brief Returns the numeric representation of a hashed string.
      * @return The numeric representation of the instance.
      */
-    [[nodiscard]] constexpr operator hash_type() const ENTT_NOEXCEPT { return value(); }
+    [[nodiscard]] constexpr operator hash_type() const ENTT_NOEXCEPT {
+        return value();
+    }
 
 private:
     const value_type *str;
     hash_type hash;
 };
 
-
 /**
  * @brief Deduction guide.
  *
@@ -205,7 +198,6 @@ private:
 template<typename Char, std::size_t N>
 basic_hashed_string(const Char (&str)[N]) -> basic_hashed_string<Char>;
 
-
 /**
  * @brief Compares two hashed strings.
  * @tparam Char Character type.
@@ -218,7 +210,6 @@ template<typename Char>
     return lhs.value() == rhs.value();
 }
 
-
 /**
  * @brief Compares two hashed strings.
  * @tparam Char Character type.
@@ -231,7 +222,6 @@ template<typename Char>
     return !(lhs == rhs);
 }
 
-
 /**
  * @brief Compares two hashed strings.
  * @tparam Char Character type.
@@ -244,7 +234,6 @@ template<typename Char>
     return lhs.value() < rhs.value();
 }
 
-
 /**
  * @brief Compares two hashed strings.
  * @tparam Char Character type.
@@ -258,7 +247,6 @@ template<typename Char>
     return lhs.value() <= rhs.value();
 }
 
-
 /**
  * @brief Compares two hashed strings.
  * @tparam Char Character type.
@@ -272,7 +260,6 @@ template<typename Char>
     return !(lhs <= rhs);
 }
 
-
 /**
  * @brief Compares two hashed strings.
  * @tparam Char Character type.
@@ -286,18 +273,14 @@ template<typename Char>
     return !(lhs < rhs);
 }
 
-
 /*! @brief Aliases for common character types. */
 using hashed_string = basic_hashed_string<char>;
 
-
 /*! @brief Aliases for common character types. */
 using hashed_wstring = basic_hashed_string<wchar_t>;
 
-
 inline namespace literals {
 
-
 /**
  * @brief User defined literal for hashed strings.
  * @param str The literal without its suffix.
@@ -307,7 +290,6 @@ inline namespace literals {
     return entt::hashed_string{str};
 }
 
-
 /**
  * @brief User defined literal for hashed wstrings.
  * @param str The literal without its suffix.
@@ -317,11 +299,8 @@ inline namespace literals {
     return entt::hashed_wstring{str};
 }
 
+} // namespace literals
 
-}
-
-
-}
-
+} // namespace entt
 
 #endif

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

@@ -1,18 +1,15 @@
 #ifndef ENTT_CORE_IDENT_HPP
 #define ENTT_CORE_IDENT_HPP
 
-
 #include <cstddef>
-#include <utility>
 #include <type_traits>
+#include <utility>
 #include "../config/config.h"
 #include "fwd.hpp"
 #include "type_traits.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Types identifiers.
  *
@@ -57,8 +54,6 @@ public:
     static constexpr identifier_type type = get<std::decay_t<Type>>(std::index_sequence_for<Types...>{});
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 11
src/entt/core/memory.hpp

@@ -1,17 +1,14 @@
 #ifndef ENTT_CORE_MEMORY_HPP
 #define ENTT_CORE_MEMORY_HPP
 
-
 #include <cstddef>
 #include <memory>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /**
  * @brief Unwraps fancy pointers, does nothing otherwise (waiting for C++20).
  * @tparam Type Pointer type.
@@ -27,7 +24,6 @@ template<typename Type>
     }
 }
 
-
 /**
  * @brief Utility function to design allocation-aware containers.
  * @tparam Allocator Type of allocator.
@@ -41,7 +37,6 @@ constexpr void propagate_on_container_copy_assignment([[maybe_unused]] Allocator
     }
 }
 
-
 /**
  * @brief Utility function to design allocation-aware containers.
  * @tparam Allocator Type of allocator.
@@ -55,7 +50,6 @@ constexpr void propagate_on_container_move_assignment([[maybe_unused]] Allocator
     }
 }
 
-
 /**
  * @brief Utility function to design allocation-aware containers.
  * @tparam Allocator Type of allocator.
@@ -73,7 +67,6 @@ constexpr void propagate_on_container_swap(Allocator &lhs, Allocator &rhs) ENTT_
     }
 }
 
-
 /**
  * @brief Checks whether a value is a power of two or not.
  * @param value A value that may or may not be a power of two.
@@ -83,7 +76,6 @@ constexpr void propagate_on_container_swap(Allocator &lhs, Allocator &rhs) ENTT_
     return value && ((value & (value - 1)) == 0);
 }
 
-
 /**
  * @brief Fast module utility function (powers of two only).
  * @tparam Value Compile-time page size, it must be a power of two.
@@ -96,8 +88,6 @@ template<std::size_t Value>
     return value & (Value - 1u);
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 7
src/entt/core/monostate.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_CORE_MONOSTATE_HPP
 #define ENTT_CORE_MONOSTATE_HPP
 
-
 #include "../config/config.h"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Minimal implementation of the monostate pattern.
  *
@@ -47,7 +44,6 @@ private:
     inline static ENTT_MAYBE_ATOMIC(Type) value{};
 };
 
-
 /**
  * @brief Helper variable template.
  * @tparam Value Value used to differentiate between different variables.
@@ -55,8 +51,6 @@ private:
 template<id_type Value>
 inline monostate<Value> monostate_v = {};
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 6
src/entt/core/tuple.hpp

@@ -1,16 +1,13 @@
 #ifndef ENTT_CORE_TUPLE_HPP
 #define ENTT_CORE_TUPLE_HPP
 
-
 #include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /**
  * @brief Utility function to unwrap tuples of a single element.
  * @tparam Type Tuple type of any sizes.
@@ -27,8 +24,6 @@ constexpr decltype(auto) unwrap_tuple(Type &&value) ENTT_NOEXCEPT {
     }
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 17 - 34
src/entt/core/type_info.hpp

@@ -1,28 +1,23 @@
 #ifndef ENTT_CORE_TYPE_INFO_HPP
 #define ENTT_CORE_TYPE_INFO_HPP
 
-
 #include <string_view>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 #include "../core/attribute.h"
-#include "hashed_string.hpp"
 #include "fwd.hpp"
-
+#include "hashed_string.hpp"
 
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 struct ENTT_API type_index final {
     [[nodiscard]] static id_type next() ENTT_NOEXCEPT {
         static ENTT_MAYBE_ATOMIC(id_type) value{};
@@ -30,12 +25,11 @@ struct ENTT_API type_index final {
     }
 };
 
-
 template<typename Type>
 [[nodiscard]] constexpr auto stripped_type_name() ENTT_NOEXCEPT {
 #if defined ENTT_PRETTY_FUNCTION
     std::string_view pretty_function{ENTT_PRETTY_FUNCTION};
-    auto first = pretty_function.find_first_not_of(' ', pretty_function.find_first_of(ENTT_PRETTY_FUNCTION_PREFIX)+1);
+    auto first = pretty_function.find_first_not_of(' ', pretty_function.find_first_of(ENTT_PRETTY_FUNCTION_PREFIX) + 1);
     auto value = pretty_function.substr(first, pretty_function.find_last_of(ENTT_PRETTY_FUNCTION_SUFFIX) - first);
     return value;
 #else
@@ -43,21 +37,18 @@ template<typename Type>
 #endif
 }
 
-
 template<typename Type, auto = stripped_type_name<Type>().find_first_of('.')>
 [[nodiscard]] static constexpr std::string_view type_name(int) ENTT_NOEXCEPT {
     constexpr auto value = stripped_type_name<Type>();
     return value;
 }
 
-
 template<typename Type>
 [[nodiscard]] static std::string_view type_name(char) ENTT_NOEXCEPT {
     static const auto value = stripped_type_name<Type>();
     return value;
 }
 
-
 template<typename Type, auto = stripped_type_name<Type>().find_first_of('.')>
 [[nodiscard]] static constexpr id_type type_hash(int) ENTT_NOEXCEPT {
     constexpr auto stripped = stripped_type_name<Type>();
@@ -65,7 +56,6 @@ template<typename Type, auto = stripped_type_name<Type>().find_first_of('.')>
     return value;
 }
 
-
 template<typename Type>
 [[nodiscard]] static id_type type_hash(char) ENTT_NOEXCEPT {
     static const auto value = [](const auto stripped) {
@@ -74,16 +64,13 @@ template<typename Type>
     return value;
 }
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Type sequential identifier.
  * @tparam Type Type for which to generate a sequential identifier.
@@ -100,10 +87,11 @@ struct ENTT_API type_index final {
     }
 
     /*! @copydoc value */
-    [[nodiscard]] constexpr operator id_type() const ENTT_NOEXCEPT { return value(); }
+    [[nodiscard]] constexpr operator id_type() const ENTT_NOEXCEPT {
+        return value();
+    }
 };
 
-
 /**
  * @brief Type hash.
  * @tparam Type Type for which to generate a hash value.
@@ -124,10 +112,11 @@ struct type_hash final {
     }
 
     /*! @copydoc value */
-    [[nodiscard]] constexpr operator id_type() const ENTT_NOEXCEPT { return value(); }
+    [[nodiscard]] constexpr operator id_type() const ENTT_NOEXCEPT {
+        return value();
+    }
 };
 
-
 /**
  * @brief Type name.
  * @tparam Type Type for which to generate a name.
@@ -143,18 +132,18 @@ struct type_name final {
     }
 
     /*! @copydoc value */
-    [[nodiscard]] constexpr operator std::string_view() const ENTT_NOEXCEPT { return value(); }
+    [[nodiscard]] constexpr operator std::string_view() const ENTT_NOEXCEPT {
+        return value();
+    }
 };
 
-
 /*! @brief Implementation specific information about a type. */
 struct type_info final {
     /*! @brief Default constructor. */
     constexpr type_info() ENTT_NOEXCEPT
         : seq{},
           identifier{},
-          alias{}
-    {}
+          alias{} {}
 
     /*! @brief Default copy constructor. */
     constexpr type_info(const type_info &) ENTT_NOEXCEPT = default;
@@ -169,20 +158,19 @@ struct type_info final {
     constexpr type_info(std::in_place_type_t<Type>) ENTT_NOEXCEPT
         : seq{type_index<std::remove_reference_t<std::remove_const_t<Type>>>::value()},
           identifier{type_hash<std::remove_reference_t<std::remove_const_t<Type>>>::value()},
-          alias{type_name<std::remove_reference_t<std::remove_const_t<Type>>>::value()}
-    {}
+          alias{type_name<std::remove_reference_t<std::remove_const_t<Type>>>::value()} {}
 
     /**
      * @brief Default copy assignment operator.
      * @return This type info object.
      */
-    constexpr type_info & operator=(const type_info &) ENTT_NOEXCEPT = default;
+    constexpr type_info &operator=(const type_info &) ENTT_NOEXCEPT = default;
 
     /**
      * @brief Default move assignment operator.
      * @return This type info object.
      */
-    constexpr type_info & operator=(type_info &&) ENTT_NOEXCEPT = default;
+    constexpr type_info &operator=(type_info &&) ENTT_NOEXCEPT = default;
 
     /**
      * @brief Checks if a type info object is properly initialized.
@@ -222,7 +210,6 @@ private:
     std::string_view alias;
 };
 
-
 /**
  * @brief Compares the contents of two type info objects.
  * @param lhs A type info object.
@@ -233,7 +220,6 @@ private:
     return lhs.hash() == rhs.hash();
 }
 
-
 /**
  * @brief Compares the contents of two type info objects.
  * @param lhs A type info object.
@@ -244,7 +230,6 @@ private:
     return !(lhs == rhs);
 }
 
-
 /**
  * @brief Returns the type info object associated to a given type.
  *
@@ -260,8 +245,6 @@ template<typename Type>
     return type_info{std::in_place_type<std::remove_cv_t<std::remove_reference_t<Type>>>};
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 25 - 107
src/entt/core/type_traits.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_CORE_TYPE_TRAITS_HPP
 #define ENTT_CORE_TYPE_TRAITS_HPP
 
-
 #include <cstddef>
 #include <iterator>
 #include <type_traits>
@@ -9,10 +8,8 @@
 #include "../config/config.h"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Utility class to disambiguate overloaded functions.
  * @tparam N Number of choices available.
@@ -23,12 +20,10 @@ struct choice_t
     : /*! @cond TURN_OFF_DOXYGEN */ choice_t<N - 1> /*! @endcond */
 {};
 
-
 /*! @copybrief choice_t */
 template<>
 struct choice_t<0> {};
 
-
 /**
  * @brief Variable template for the choice trick.
  * @tparam N Number of choices available.
@@ -36,7 +31,6 @@ struct choice_t<0> {};
 template<std::size_t N>
 inline constexpr choice_t<N> choice{};
 
-
 /**
  * @brief Identity type trait.
  *
@@ -51,7 +45,6 @@ struct type_identity {
     using type = Type;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam Type A type.
@@ -59,7 +52,6 @@ struct type_identity {
 template<typename Type>
 using type_identity_t = typename type_identity<Type>::type;
 
-
 /**
  * @brief A type-only `sizeof` wrapper that returns 0 where `sizeof` complains.
  * @tparam Type The type of which to return the size.
@@ -68,13 +60,10 @@ using type_identity_t = typename type_identity<Type>::type;
 template<typename Type, typename = void>
 struct size_of: std::integral_constant<std::size_t, 0u> {};
 
-
 /*! @copydoc size_of */
 template<typename Type>
 struct size_of<Type, std::void_t<decltype(sizeof(Type))>>
-    : std::integral_constant<std::size_t, sizeof(Type)>
-{};
-
+    : std::integral_constant<std::size_t, sizeof(Type)> {};
 
 /**
  * @brief Helper variable template.
@@ -83,7 +72,6 @@ struct size_of<Type, std::void_t<decltype(sizeof(Type))>>
 template<typename Type>
 inline constexpr std::size_t size_of_v = size_of<Type>::value;
 
-
 /**
  * @brief Using declaration to be used to _repeat_ the same type a number of
  * times equal to the size of a given parameter pack.
@@ -92,7 +80,6 @@ inline constexpr std::size_t size_of_v = size_of<Type>::value;
 template<typename Type, typename>
 using unpack_as_t = Type;
 
-
 /**
  * @brief Helper variable template to be used to _repeat_ the same value a
  * number of times equal to the size of a given parameter pack.
@@ -101,7 +88,6 @@ using unpack_as_t = Type;
 template<auto Value, typename>
 inline constexpr auto unpack_as_v = Value;
 
-
 /**
  * @brief Wraps a static constant.
  * @tparam Value A static constant.
@@ -109,7 +95,6 @@ inline constexpr auto unpack_as_v = Value;
 template<auto Value>
 using integral_constant = std::integral_constant<decltype(Value), Value>;
 
-
 /**
  * @brief Alias template to facilitate the creation of named values.
  * @tparam Value A constant value at least convertible to `id_type`.
@@ -117,7 +102,6 @@ using integral_constant = std::integral_constant<decltype(Value), Value>;
 template<id_type Value>
 using tag = integral_constant<Value>;
 
-
 /**
  * @brief A class to use to push around lists of types, nothing more.
  * @tparam Type Types provided by the type list.
@@ -130,12 +114,10 @@ struct type_list {
     static constexpr auto size = sizeof...(Type);
 };
 
-
 /*! @brief Primary template isn't defined on purpose. */
 template<std::size_t, typename>
 struct type_list_element;
 
-
 /**
  * @brief Provides compile-time indexed access to the types of a type list.
  * @tparam Index Index of the type to return.
@@ -144,9 +126,7 @@ struct type_list_element;
  */
 template<std::size_t Index, typename Type, typename... Other>
 struct type_list_element<Index, type_list<Type, Other...>>
-    : type_list_element<Index - 1u, type_list<Other...>>
-{};
-
+    : type_list_element<Index - 1u, type_list<Other...>> {};
 
 /**
  * @brief Provides compile-time indexed access to the types of a type list.
@@ -159,7 +139,6 @@ struct type_list_element<0u, type_list<Type, Other...>> {
     using type = Type;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam Index Index of the type to return.
@@ -168,7 +147,6 @@ struct type_list_element<0u, type_list<Type, Other...>> {
 template<std::size_t Index, typename List>
 using type_list_element_t = typename type_list_element<Index, List>::type;
 
-
 /**
  * @brief Concatenates multiple type lists.
  * @tparam Type Types provided by the first type list.
@@ -176,14 +154,14 @@ using type_list_element_t = typename type_list_element<Index, List>::type;
  * @return A type list composed by the types of both the type lists.
  */
 template<typename... Type, typename... Other>
-constexpr type_list<Type..., Other...> operator+(type_list<Type...>, type_list<Other...>) { return {}; }
-
+constexpr type_list<Type..., Other...> operator+(type_list<Type...>, type_list<Other...>) {
+    return {};
+}
 
 /*! @brief Primary template isn't defined on purpose. */
 template<typename...>
 struct type_list_cat;
 
-
 /*! @brief Concatenates multiple type lists. */
 template<>
 struct type_list_cat<> {
@@ -191,7 +169,6 @@ struct type_list_cat<> {
     using type = type_list<>;
 };
 
-
 /**
  * @brief Concatenates multiple type lists.
  * @tparam Type Types provided by the first type list.
@@ -204,7 +181,6 @@ struct type_list_cat<type_list<Type...>, type_list<Other...>, List...> {
     using type = typename type_list_cat<type_list<Type..., Other...>, List...>::type;
 };
 
-
 /**
  * @brief Concatenates multiple type lists.
  * @tparam Type Types provided by the type list.
@@ -215,7 +191,6 @@ struct type_list_cat<type_list<Type...>> {
     using type = type_list<Type...>;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam List Type lists to concatenate.
@@ -223,12 +198,10 @@ struct type_list_cat<type_list<Type...>> {
 template<typename... List>
 using type_list_cat_t = typename type_list_cat<List...>::type;
 
-
 /*! @brief Primary template isn't defined on purpose. */
 template<typename>
 struct type_list_unique;
 
-
 /**
  * @brief Removes duplicates types from a type list.
  * @tparam Type One of the types provided by the given type list.
@@ -240,11 +213,9 @@ struct type_list_unique<type_list<Type, Other...>> {
     using type = std::conditional_t<
         std::disjunction_v<std::is_same<Type, Other>...>,
         typename type_list_unique<type_list<Other...>>::type,
-        type_list_cat_t<type_list<Type>, typename type_list_unique<type_list<Other...>>::type>
-    >;
+        type_list_cat_t<type_list<Type>, typename type_list_unique<type_list<Other...>>::type>>;
 };
 
-
 /*! @brief Removes duplicates types from a type list. */
 template<>
 struct type_list_unique<type_list<>> {
@@ -252,7 +223,6 @@ struct type_list_unique<type_list<>> {
     using type = type_list<>;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam Type A type list.
@@ -260,7 +230,6 @@ struct type_list_unique<type_list<>> {
 template<typename Type>
 using type_list_unique_t = typename type_list_unique<Type>::type;
 
-
 /**
  * @brief Provides the member constant `value` to true if a type list contains a
  * given type, false otherwise.
@@ -270,7 +239,6 @@ using type_list_unique_t = typename type_list_unique<Type>::type;
 template<typename List, typename Type>
 struct type_list_contains;
 
-
 /**
  * @copybrief type_list_contains
  * @tparam Type Types provided by the type list.
@@ -279,7 +247,6 @@ struct type_list_contains;
 template<typename... Type, typename Other>
 struct type_list_contains<type_list<Type...>, Other>: std::disjunction<std::is_same<Type, Other>...> {};
 
-
 /**
  * @brief Helper variable template.
  * @tparam List Type list.
@@ -288,12 +255,10 @@ struct type_list_contains<type_list<Type...>, Other>: std::disjunction<std::is_s
 template<typename List, typename Type>
 inline constexpr bool type_list_contains_v = type_list_contains<List, Type>::value;
 
-
 /*! @brief Primary template isn't defined on purpose. */
 template<typename...>
 struct type_list_diff;
 
-
 /**
  * @brief Computes the difference between two type lists.
  * @tparam Type Types provided by the first type list.
@@ -305,7 +270,6 @@ struct type_list_diff<type_list<Type...>, type_list<Other...>> {
     using type = type_list_cat_t<std::conditional_t<type_list_contains_v<type_list<Other...>, Type>, type_list<>, type_list<Type>>...>;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam List Type lists between which to compute the difference.
@@ -313,7 +277,6 @@ struct type_list_diff<type_list<Type...>, type_list<Other...>> {
 template<typename... List>
 using type_list_diff_t = typename type_list_diff<List...>::type;
 
-
 /**
  * @brief A class to use to push around lists of constant values, nothing more.
  * @tparam Value Values provided by the value list.
@@ -326,12 +289,10 @@ struct value_list {
     static constexpr auto size = sizeof...(Value);
 };
 
-
 /*! @brief Primary template isn't defined on purpose. */
 template<std::size_t, typename>
 struct value_list_element;
 
-
 /**
  * @brief Provides compile-time indexed access to the values of a value list.
  * @tparam Index Index of the value to return.
@@ -340,9 +301,7 @@ struct value_list_element;
  */
 template<std::size_t Index, auto Value, auto... Other>
 struct value_list_element<Index, value_list<Value, Other...>>
-    : value_list_element<Index - 1u, value_list<Other...>>
-{};
-
+    : value_list_element<Index - 1u, value_list<Other...>> {};
 
 /**
  * @brief Provides compile-time indexed access to the types of a type list.
@@ -355,7 +314,6 @@ struct value_list_element<0u, value_list<Value, Other...>> {
     static constexpr auto value = Value;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam Index Index of the value to return.
@@ -364,7 +322,6 @@ struct value_list_element<0u, value_list<Value, Other...>> {
 template<std::size_t Index, typename List>
 inline constexpr auto value_list_element_v = value_list_element<Index, List>::value;
 
-
 /**
  * @brief Concatenates multiple value lists.
  * @tparam Value Values provided by the first value list.
@@ -372,14 +329,14 @@ inline constexpr auto value_list_element_v = value_list_element<Index, List>::va
  * @return A value list composed by the values of both the value lists.
  */
 template<auto... Value, auto... Other>
-constexpr value_list<Value..., Other...> operator+(value_list<Value...>, value_list<Other...>) { return {}; }
-
+constexpr value_list<Value..., Other...> operator+(value_list<Value...>, value_list<Other...>) {
+    return {};
+}
 
 /*! @brief Primary template isn't defined on purpose. */
 template<typename...>
 struct value_list_cat;
 
-
 /*! @brief Concatenates multiple value lists. */
 template<>
 struct value_list_cat<> {
@@ -387,7 +344,6 @@ struct value_list_cat<> {
     using type = value_list<>;
 };
 
-
 /**
  * @brief Concatenates multiple value lists.
  * @tparam Value Values provided by the first value list.
@@ -400,7 +356,6 @@ struct value_list_cat<value_list<Value...>, value_list<Other...>, List...> {
     using type = typename value_list_cat<value_list<Value..., Other...>, List...>::type;
 };
 
-
 /**
  * @brief Concatenates multiple value lists.
  * @tparam Value Values provided by the value list.
@@ -411,7 +366,6 @@ struct value_list_cat<value_list<Value...>> {
     using type = value_list<Value...>;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam List Value lists to concatenate.
@@ -419,12 +373,10 @@ struct value_list_cat<value_list<Value...>> {
 template<typename... List>
 using value_list_cat_t = typename value_list_cat<List...>::type;
 
-
 /*! @brief Same as std::is_invocable, but with tuples. */
 template<typename, typename>
 struct is_applicable: std::false_type {};
 
-
 /**
  * @copybrief is_applicable
  * @tparam Func A valid function type.
@@ -434,7 +386,6 @@ struct is_applicable: std::false_type {};
 template<typename Func, template<typename...> class Tuple, typename... Args>
 struct is_applicable<Func, Tuple<Args...>>: std::is_invocable<Func, Args...> {};
 
-
 /**
  * @copybrief is_applicable
  * @tparam Func A valid function type.
@@ -444,7 +395,6 @@ struct is_applicable<Func, Tuple<Args...>>: std::is_invocable<Func, Args...> {};
 template<typename Func, template<typename...> class Tuple, typename... Args>
 struct is_applicable<Func, const Tuple<Args...>>: std::is_invocable<Func, Args...> {};
 
-
 /**
  * @brief Helper variable template.
  * @tparam Func A valid function type.
@@ -453,12 +403,10 @@ struct is_applicable<Func, const Tuple<Args...>>: std::is_invocable<Func, Args..
 template<typename Func, typename Args>
 inline constexpr bool is_applicable_v = is_applicable<Func, Args>::value;
 
-
 /*! @brief Same as std::is_invocable_r, but with tuples for arguments. */
 template<typename, typename, typename>
 struct is_applicable_r: std::false_type {};
 
-
 /**
  * @copybrief is_applicable_r
  * @tparam Ret The type to which the return type of the function should be
@@ -469,7 +417,6 @@ struct is_applicable_r: std::false_type {};
 template<typename Ret, typename Func, typename... Args>
 struct is_applicable_r<Ret, Func, std::tuple<Args...>>: std::is_invocable_r<Ret, Func, Args...> {};
 
-
 /**
  * @brief Helper variable template.
  * @tparam Ret The type to which the return type of the function should be
@@ -480,7 +427,6 @@ struct is_applicable_r<Ret, Func, std::tuple<Args...>>: std::is_invocable_r<Ret,
 template<typename Ret, typename Func, typename Args>
 inline constexpr bool is_applicable_r_v = is_applicable_r<Ret, Func, Args>::value;
 
-
 /**
  * @brief Provides the member constant `value` to true if a given type is
  * complete, false otherwise.
@@ -489,12 +435,10 @@ inline constexpr bool is_applicable_r_v = is_applicable_r<Ret, Func, Args>::valu
 template<typename Type, typename = void>
 struct is_complete: std::false_type {};
 
-
 /*! @copydoc is_complete */
 template<typename Type>
 struct is_complete<Type, std::void_t<decltype(sizeof(Type))>>: std::true_type {};
 
-
 /**
  * @brief Helper variable template.
  * @tparam Type The type to test.
@@ -502,7 +446,6 @@ struct is_complete<Type, std::void_t<decltype(sizeof(Type))>>: std::true_type {}
 template<typename Type>
 inline constexpr bool is_complete_v = is_complete<Type>::value;
 
-
 /**
  * @brief Provides the member constant `value` to true if a given type is an
  * iterator, false otherwise.
@@ -511,13 +454,10 @@ inline constexpr bool is_complete_v = is_complete<Type>::value;
 template<typename Type, typename = void>
 struct is_iterator: std::false_type {};
 
-
 /*! @copydoc is_iterator */
 template<typename Type>
 struct is_iterator<Type, std::void_t<typename std::iterator_traits<Type>::iterator_category>>
-    : std::true_type
-{};
-
+    : std::true_type {};
 
 /**
  * @brief Helper variable template.
@@ -526,7 +466,6 @@ struct is_iterator<Type, std::void_t<typename std::iterator_traits<Type>::iterat
 template<typename Type>
 inline constexpr bool is_iterator_v = is_iterator<Type>::value;
 
-
 /**
  * @brief Provides the member constant `value` to true if a given type is of the
  * required iterator type, false otherwise.
@@ -536,20 +475,15 @@ inline constexpr bool is_iterator_v = is_iterator<Type>::value;
 template<typename Type, typename It, typename = void>
 struct is_iterator_type: std::false_type {};
 
-
 /*! @copydoc is_iterator_type */
 template<typename Type, typename It>
 struct is_iterator_type<Type, It, std::enable_if_t<is_iterator_v<Type> && std::is_same_v<Type, It>>>
-    : std::true_type
-{};
-
+    : std::true_type {};
 
 /*! @copydoc is_iterator_type */
 template<typename Type, typename It>
 struct is_iterator_type<Type, It, std::enable_if_t<!std::is_same_v<Type, It>, std::void_t<typename It::iterator_type>>>
-    : is_iterator_type<Type, typename It::iterator_type>
-{};
-
+    : is_iterator_type<Type, typename It::iterator_type> {};
 
 /**
  * @brief Helper variable template.
@@ -559,7 +493,6 @@ struct is_iterator_type<Type, It, std::enable_if_t<!std::is_same_v<Type, It>, st
 template<typename Type, typename It>
 inline constexpr bool is_iterator_type_v = is_iterator_type<Type, It>::value;
 
-
 /**
  * @brief Provides the member constant `value` to true if a given type is both
  * an empty and non-final class, false otherwise.
@@ -567,9 +500,7 @@ inline constexpr bool is_iterator_type_v = is_iterator_type<Type, It>::value;
  */
 template<typename Type>
 struct is_ebco_eligible
-    : std::conjunction<std::is_empty<Type>, std::negation<std::is_final<Type>>>
-{};
-
+    : std::conjunction<std::is_empty<Type>, std::negation<std::is_final<Type>>> {};
 
 /**
  * @brief Helper variable template.
@@ -578,23 +509,22 @@ struct is_ebco_eligible
 template<typename Type>
 inline constexpr bool is_ebco_eligible_v = is_ebco_eligible<Type>::value;
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename>
-[[nodiscard]] constexpr bool is_equality_comparable(...) { return false; }
-
+[[nodiscard]] constexpr bool is_equality_comparable(...) {
+    return false;
+}
 
 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>()) {
@@ -607,22 +537,18 @@ 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>()) {
     return is_equality_comparable<typename Type::key_type>(choice<2>) && is_equality_comparable<typename Type::mapped_type>(choice<2>);
 }
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Provides the member constant `value` to true if a given type is
  * equality comparable, false otherwise.
@@ -631,7 +557,6 @@ template<typename Type>
 template<typename Type, typename = void>
 struct is_equality_comparable: std::bool_constant<internal::is_equality_comparable<Type>(choice<2>)> {};
 
-
 /**
  * @brief Helper variable template.
  * @tparam Type The type to test.
@@ -639,7 +564,6 @@ struct is_equality_comparable: std::bool_constant<internal::is_equality_comparab
 template<typename Type>
 inline constexpr bool is_equality_comparable_v = is_equality_comparable<Type>::value;
 
-
 /**
  * @brief Transcribes the constness of a type to another type.
  * @tparam To The type to which to transcribe the constness.
@@ -651,7 +575,6 @@ struct constness_as {
     using type = std::remove_const_t<To>;
 };
 
-
 /*! @copydoc constness_as */
 template<typename To, typename From>
 struct constness_as<To, const From> {
@@ -659,7 +582,6 @@ struct constness_as<To, const From> {
     using type = std::add_const_t<To>;
 };
 
-
 /**
  * @brief Alias template to facilitate the transcription of the constness.
  * @tparam To The type to which to transcribe the constness.
@@ -668,7 +590,6 @@ struct constness_as<To, const From> {
 template<typename To, typename From>
 using constness_as_t = typename constness_as<To, From>::type;
 
-
 /**
  * @brief Extracts the class of a non-static member object or function.
  * @tparam Member A pointer to a non-static member object or function.
@@ -678,20 +599,19 @@ class member_class {
     static_assert(std::is_member_pointer_v<Member>, "Invalid pointer type to non-static member object or function");
 
     template<typename Class, typename Ret, typename... Args>
-    static Class * clazz(Ret(Class:: *)(Args...));
+    static Class *clazz(Ret (Class::*)(Args...));
 
     template<typename Class, typename Ret, typename... Args>
-    static Class * clazz(Ret(Class:: *)(Args...) const);
+    static Class *clazz(Ret (Class::*)(Args...) const);
 
     template<typename Class, typename Type>
-    static Class * clazz(Type Class:: *);
+    static Class *clazz(Type Class::*);
 
 public:
     /*! @brief The class of the given non-static member object or function. */
     using type = std::remove_pointer_t<decltype(clazz(std::declval<Member>()))>;
 };
 
-
 /**
  * @brief Helper type.
  * @tparam Member A pointer to a non-static member object or function.
@@ -699,8 +619,6 @@ public:
 template<typename Member>
 using member_class_t = typename member_class<Member>::type;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 14 - 21
src/entt/core/utility.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_CORE_UTILITY_HPP
 #define ENTT_CORE_UTILITY_HPP
 
-
 #include <utility>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /*! @brief Identity function object (waiting for C++20). */
 struct identity {
     /**
@@ -18,12 +15,11 @@ struct identity {
      * @return The submitted value as-is.
      */
     template<class Type>
-    [[nodiscard]] constexpr Type && operator()(Type &&value) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr Type &&operator()(Type &&value) const ENTT_NOEXCEPT {
         return std::forward<Type>(value);
     }
 };
 
-
 /**
  * @brief Constant utility to disambiguate overloaded members of a class.
  * @tparam Type Type of the desired overload.
@@ -32,8 +28,9 @@ struct identity {
  * @return Pointer to the member.
  */
 template<typename Type, typename Class>
-[[nodiscard]] constexpr auto overload(Type Class:: *member) ENTT_NOEXCEPT { return member; }
-
+[[nodiscard]] constexpr auto overload(Type Class::*member) ENTT_NOEXCEPT {
+    return member;
+}
 
 /**
  * @brief Constant utility to disambiguate overloaded functions.
@@ -42,8 +39,9 @@ template<typename Type, typename Class>
  * @return Pointer to the function.
  */
 template<typename Func>
-[[nodiscard]] constexpr auto overload(Func *func) ENTT_NOEXCEPT { return func; }
-
+[[nodiscard]] constexpr auto overload(Func *func) ENTT_NOEXCEPT {
+    return func;
+}
 
 /**
  * @brief Helper type for visitors.
@@ -54,7 +52,6 @@ struct overloaded: Func... {
     using Func::operator()...;
 };
 
-
 /**
  * @brief Deduction guide.
  * @tparam Func Types of function objects.
@@ -62,7 +59,6 @@ struct overloaded: Func... {
 template<class... Func>
 overloaded(Func...) -> overloaded<Func...>;
 
-
 /**
  * @brief Basic implementation of a y-combinator.
  * @tparam Func Type of a potentially recursive function.
@@ -73,9 +69,8 @@ struct y_combinator {
      * @brief Constructs a y-combinator from a given function.
      * @param recursive A potentially recursive function.
      */
-    y_combinator(Func recursive):
-        func{std::move(recursive)}
-    {}
+    y_combinator(Func recursive)
+        : func{std::move(recursive)} {}
 
     /**
      * @brief Invokes a y-combinator and therefore its underlying function.
@@ -83,14 +78,14 @@ struct y_combinator {
      * @param args Parameters to use to invoke the underlying function.
      * @return Return value of the underlying function, if any.
      */
-    template <class... Args>
-    decltype(auto) operator()(Args &&... args) const {
+    template<class... Args>
+    decltype(auto) operator()(Args &&...args) const {
         return func(*this, std::forward<Args>(args)...);
     }
 
     /*! @copydoc operator()() */
-    template <class... Args>
-    decltype(auto) operator()(Args &&... args) {
+    template<class... Args>
+    decltype(auto) operator()(Args &&...args) {
         return func(*this, std::forward<Args>(args)...);
     }
 
@@ -98,8 +93,6 @@ private:
     Func func;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 2 - 10
src/entt/entity/component.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_ENTITY_COMPONENT_HPP
 #define ENTT_ENTITY_COMPONENT_HPP
 
-
 #include <type_traits>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /*! @brief Commonly used default traits for all types. */
 struct basic_component_traits {
     /*! @brief Pointer stability, default is `std::false_type`. */
@@ -17,7 +14,6 @@ struct basic_component_traits {
     using ignore_if_empty = ENTT_IGNORE_IF_EMPTY;
 };
 
-
 /**
  * @brief Common way to access various properties of components.
  * @tparam Type Type of component.
@@ -27,7 +23,6 @@ struct component_traits: basic_component_traits {
     static_assert(std::is_same_v<std::decay_t<Type>, Type>, "Unsupported type");
 };
 
-
 /**
  * @brief Helper variable template.
  * @tparam Type Type of component.
@@ -35,16 +30,13 @@ struct component_traits: basic_component_traits {
 template<class Type>
 inline constexpr bool in_place_delete_v = component_traits<Type>::in_place_delete::value;
 
-
 /**
  * @brief Helper variable template.
  * @tparam Type Type of component.
  */
 template<class Type>
-inline constexpr bool ignore_as_empty_v = component_traits<Type>::ignore_if_empty::value && std::is_empty_v<Type>;
-
-
-}
+inline constexpr bool ignore_as_empty_v = component_traits<Type>::ignore_if_empty::value &&std::is_empty_v<Type>;
 
+} // namespace entt
 
 #endif

+ 4 - 29
src/entt/entity/entity.hpp

@@ -1,40 +1,30 @@
 #ifndef ENTT_ENTITY_ENTITY_HPP
 #define ENTT_ENTITY_ENTITY_HPP
 
-
 #include <cstddef>
 #include <cstdint>
 #include <type_traits>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename, typename = void>
 struct entt_traits;
 
-
 template<typename Type>
 struct entt_traits<Type, std::enable_if_t<std::is_enum_v<Type>>>
-    : entt_traits<std::underlying_type_t<Type>>
-{};
-
+    : entt_traits<std::underlying_type_t<Type>> {};
 
 template<typename Type>
 struct entt_traits<Type, std::enable_if_t<std::is_class_v<Type>>>
-    : entt_traits<typename Type::entity_type>
-{};
-
+    : entt_traits<typename Type::entity_type> {};
 
 template<>
 struct entt_traits<std::uint32_t> {
@@ -46,7 +36,6 @@ struct entt_traits<std::uint32_t> {
     static constexpr std::size_t entity_shift = 20u;
 };
 
-
 template<>
 struct entt_traits<std::uint64_t> {
     using entity_type = std::uint64_t;
@@ -57,16 +46,13 @@ struct entt_traits<std::uint64_t> {
     static constexpr std::size_t entity_shift = 32u;
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Entity traits.
  * @tparam Type Type of identifier.
@@ -143,7 +129,6 @@ public:
     }
 };
 
-
 /**
  * @brief Converts an entity to its underlying type.
  * @tparam Entity The value type.
@@ -155,7 +140,6 @@ template<typename Entity>
     return entt_traits<Entity>::to_integral(entity);
 }
 
-
 /*! @brief Null object for all identifiers.  */
 struct null_t {
     /**
@@ -211,7 +195,6 @@ struct null_t {
     }
 };
 
-
 /**
  * @brief Compares a null object and an identifier of any type.
  * @tparam Entity Type of identifier.
@@ -224,7 +207,6 @@ template<typename Entity>
     return other.operator==(entity);
 }
 
-
 /**
  * @brief Compares a null object and an identifier of any type.
  * @tparam Entity Type of identifier.
@@ -237,7 +219,6 @@ template<typename Entity>
     return !(other == entity);
 }
 
-
 /*! @brief Tombstone object for all identifiers.  */
 struct tombstone_t {
     /**
@@ -293,7 +274,6 @@ struct tombstone_t {
     }
 };
 
-
 /**
  * @brief Compares a tombstone object and an identifier of any type.
  * @tparam Entity Type of identifier.
@@ -306,7 +286,6 @@ template<typename Entity>
     return other.operator==(entity);
 }
 
-
 /**
  * @brief Compares a tombstone object and an identifier of any type.
  * @tparam Entity Type of identifier.
@@ -319,7 +298,6 @@ template<typename Entity>
     return !(other == entity);
 }
 
-
 /**
  * @brief Compile-time constant for null entities.
  *
@@ -329,7 +307,6 @@ template<typename Entity>
  */
 inline constexpr null_t null{};
 
-
 /**
  * @brief Compile-time constant for tombstone entities.
  *
@@ -339,8 +316,6 @@ inline constexpr null_t null{};
  */
 inline constexpr tombstone_t tombstone{};
 
-
-}
-
+} // namespace entt
 
 #endif

+ 2 - 34
src/entt/entity/fwd.hpp

@@ -1,71 +1,54 @@
 #ifndef ENTT_ENTITY_FWD_HPP
 #define ENTT_ENTITY_FWD_HPP
 
-
 #include <memory>
 #include "../core/fwd.hpp"
 #include "utility.hpp"
 
-
 namespace entt {
 
-
 template<typename Entity, typename = std::allocator<Entity>>
 class basic_sparse_set;
 
-
 template<typename, typename Type, typename = std::allocator<Type>, typename = void>
 class basic_storage;
 
-
 template<typename>
 class basic_registry;
 
-
 template<typename, typename, typename, typename = void>
 class basic_view;
 
-
 template<typename>
 class basic_runtime_view;
 
-
 template<typename, typename, typename, typename>
 class basic_group;
 
-
 template<typename>
 class basic_observer;
 
-
 template<typename>
 class basic_organizer;
 
-
 template<typename, typename...>
 struct basic_handle;
 
-
 template<typename>
 class basic_snapshot;
 
-
 template<typename>
 class basic_snapshot_loader;
 
-
 template<typename>
 class basic_continuous_loader;
 
-
 /*! @brief Default entity identifier. */
-enum class entity: id_type {};
-
+enum class entity : id_type {};
 
 /*! @brief Alias declaration for the most common use case. */
 using sparse_set = basic_sparse_set<entity>;
 
-
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Args Other template parameters.
@@ -73,27 +56,21 @@ using sparse_set = basic_sparse_set<entity>;
 template<typename... Args>
 using storage = basic_storage<entity, Args...>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using registry = basic_registry<entity>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using observer = basic_observer<entity>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using organizer = basic_organizer<entity>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using handle = basic_handle<entity>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using const_handle = basic_handle<const entity>;
 
-
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Args Other template parameters.
@@ -101,7 +78,6 @@ using const_handle = basic_handle<const entity>;
 template<typename... Args>
 using handle_view = basic_handle<entity, Args...>;
 
-
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Args Other template parameters.
@@ -109,19 +85,15 @@ using handle_view = basic_handle<entity, Args...>;
 template<typename... Args>
 using const_handle_view = basic_handle<const entity, Args...>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using snapshot = basic_snapshot<entity>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using snapshot_loader = basic_snapshot_loader<entity>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using continuous_loader = basic_continuous_loader<entity>;
 
-
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Get Types of components iterated by the view.
@@ -130,11 +102,9 @@ using continuous_loader = basic_continuous_loader<entity>;
 template<typename Get, typename Exclude = exclude_t<>>
 using view = basic_view<entity, Get, Exclude>;
 
-
 /*! @brief Alias declaration for the most common use case. */
 using runtime_view = basic_runtime_view<entity>;
 
-
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Args Other template parameters.
@@ -142,8 +112,6 @@ using runtime_view = basic_runtime_view<entity>;
 template<typename... Args>
 using group = basic_group<entity, Args...>;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 27 - 45
src/entt/entity/group.hpp

@@ -1,10 +1,9 @@
 #ifndef ENTT_ENTITY_GROUP_HPP
 #define ENTT_ENTITY_GROUP_HPP
 
-
 #include <tuple>
-#include <utility>
 #include <type_traits>
+#include <utility>
 #include "../config/config.h"
 #include "../core/type_traits.hpp"
 #include "entity.hpp"
@@ -13,10 +12,8 @@
 #include "storage.hpp"
 #include "utility.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Group.
  *
@@ -26,7 +23,6 @@ namespace entt {
 template<typename, typename, typename, typename>
 class basic_group;
 
-
 /**
  * @brief Non-owning group.
  *
@@ -85,10 +81,9 @@ class basic_group<Entity, owned_t<>, get_t<Get...>, exclude_t<Exclude...>> final
             template<typename... Args>
             iterable_iterator(It from, const std::tuple<storage_type<Get> *...> &args) ENTT_NOEXCEPT
                 : it{from},
-                  pools{args}
-            {}
+                  pools{args} {}
 
-            iterable_iterator & operator++() ENTT_NOEXCEPT {
+            iterable_iterator &operator++() ENTT_NOEXCEPT {
                 return ++it, *this;
             }
 
@@ -119,10 +114,9 @@ class basic_group<Entity, owned_t<>, get_t<Get...>, exclude_t<Exclude...>> final
         using iterator = iterable_iterator<typename basic_common_type::iterator>;
         using reverse_iterator = iterable_iterator<typename basic_common_type::reverse_iterator>;
 
-        iterable(basic_common_type * const ref, const std::tuple<storage_type<Get> *...> &cpools)
+        iterable(basic_common_type *const ref, const std::tuple<storage_type<Get> *...> &cpools)
             : handler{ref},
-              pools{cpools}
-        {}
+              pools{cpools} {}
 
         [[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
             return handler ? iterator{handler->begin(), pools} : iterator{{}, pools};
@@ -141,14 +135,13 @@ class basic_group<Entity, owned_t<>, get_t<Get...>, exclude_t<Exclude...>> final
         }
 
     private:
-        basic_common_type * const handler;
+        basic_common_type *const handler;
         const std::tuple<storage_type<Get> *...> pools;
     };
 
-    basic_group(basic_common_type &ref, storage_type<Get> &... gpool) ENTT_NOEXCEPT
+    basic_group(basic_common_type &ref, storage_type<Get> &...gpool) ENTT_NOEXCEPT
         : handler{&ref},
-          pools{&gpool...}
-    {}
+          pools{&gpool...} {}
 
 public:
     /*! @brief Underlying entity identifier. */
@@ -164,8 +157,7 @@ public:
 
     /*! @brief Default constructor to use to create empty, invalid groups. */
     basic_group() ENTT_NOEXCEPT
-        : handler{}
-    {}
+        : handler{} {}
 
     /**
      * @brief Returns the number of entities that have the given components.
@@ -436,7 +428,7 @@ public:
      * @param args Arguments to forward to the sort function object, if any.
      */
     template<typename... Component, typename Compare, typename Sort = std_sort, typename... Args>
-    void sort(Compare compare, Sort algo = Sort{}, Args &&... args) {
+    void sort(Compare compare, Sort algo = Sort{}, Args &&...args) {
         if(*this) {
             if constexpr(sizeof...(Component) == 0) {
                 static_assert(std::is_invocable_v<Compare, const entity_type, const entity_type>, "Invalid comparison function");
@@ -479,11 +471,10 @@ public:
     }
 
 private:
-    basic_common_type * const handler;
+    basic_common_type *const handler;
     const std::tuple<storage_type<Get> *...> pools;
 };
 
-
 /**
  * @brief Owning group.
  *
@@ -556,10 +547,9 @@ class basic_group<Entity, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...
             iterable_iterator(It from, const std::tuple<Other...> &other, const std::tuple<storage_type<Get> *...> &cpools) ENTT_NOEXCEPT
                 : it{from},
                   owned{std::get<OIt>(other)...},
-                  get{cpools}
-            {}
+                  get{cpools} {}
 
-            iterable_iterator & operator++() ENTT_NOEXCEPT {
+            iterable_iterator &operator++() ENTT_NOEXCEPT {
                 return ++it, (++std::get<OIt>(owned), ...), *this;
             }
 
@@ -572,8 +562,7 @@ class basic_group<Entity, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...
                 return std::tuple_cat(
                     std::make_tuple(*it),
                     std::forward_as_tuple(*std::get<OIt>(owned)...),
-                    std::get<storage_type<Get> *>(get)->get_as_tuple(*it)...
-                );
+                    std::get<storage_type<Get> *>(get)->get_as_tuple(*it)...);
             }
 
             [[nodiscard]] bool operator==(const iterable_iterator &other) const ENTT_NOEXCEPT {
@@ -593,17 +582,14 @@ class basic_group<Entity, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...
     public:
         using iterator = iterable_iterator<
             typename basic_common_type::iterator,
-            type_list_cat_t<std::conditional_t<ignore_as_empty_v<std::remove_const_t<Owned>>, type_list<>, type_list<decltype(std::declval<storage_type<Owned>>().end())>>...>
-        >;
+            type_list_cat_t<std::conditional_t<ignore_as_empty_v<std::remove_const_t<Owned>>, type_list<>, type_list<decltype(std::declval<storage_type<Owned>>().end())>>...>>;
         using reverse_iterator = iterable_iterator<
             typename basic_common_type::reverse_iterator,
-            type_list_cat_t<std::conditional_t<ignore_as_empty_v<std::remove_const_t<Owned>>, type_list<>, type_list<decltype(std::declval<storage_type<Owned>>().rbegin())>>...>
-        >;
+            type_list_cat_t<std::conditional_t<ignore_as_empty_v<std::remove_const_t<Owned>>, type_list<>, type_list<decltype(std::declval<storage_type<Owned>>().rbegin())>>...>>;
 
-        iterable(std::tuple<storage_type<Owned> *..., storage_type<Get> *...> cpools, const std::size_t * const extent)
+        iterable(std::tuple<storage_type<Owned> *..., storage_type<Get> *...> cpools, const std::size_t *const extent)
             : pools{cpools},
-              length{extent}
-        {}
+              length{extent} {}
 
         [[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
             auto it = length ? (std::get<0>(pools)->basic_common_type::end() - *length) : typename basic_common_type::iterator{};
@@ -627,13 +613,12 @@ class basic_group<Entity, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...
 
     private:
         const std::tuple<storage_type<Owned> *..., storage_type<Get> *...> pools;
-        const std::size_t * const length;
+        const std::size_t *const length;
     };
 
-    basic_group(const std::size_t &extent, storage_type<Owned> &... opool, storage_type<Get> &... gpool) ENTT_NOEXCEPT
+    basic_group(const std::size_t &extent, storage_type<Owned> &...opool, storage_type<Get> &...gpool) ENTT_NOEXCEPT
         : pools{&opool..., &gpool...},
-          length{&extent}
-    {}
+          length{&extent} {}
 
 public:
     /*! @brief Underlying entity identifier. */
@@ -649,8 +634,7 @@ public:
 
     /*! @brief Default constructor to use to create empty, invalid groups. */
     basic_group() ENTT_NOEXCEPT
-        : length{}
-    {}
+        : length{} {}
 
     /**
      * @brief Returns the number of entities that have the given components.
@@ -862,7 +846,7 @@ public:
             if constexpr(is_applicable_v<Func, decltype(std::tuple_cat(std::tuple<entity_type>{}, std::declval<basic_group>().get({})))>) {
                 std::apply(func, args);
             } else {
-                std::apply([&func](auto, auto &&... less) { func(std::forward<decltype(less)>(less)...); }, args);
+                std::apply([&func](auto, auto &&...less) { func(std::forward<decltype(less)>(less)...); }, args);
             }
         }
     }
@@ -922,7 +906,7 @@ public:
      * @param args Arguments to forward to the sort function object, if any.
      */
     template<typename... Component, typename Compare, typename Sort = std_sort, typename... Args>
-    void sort(Compare compare, Sort algo = Sort{}, Args &&... args) const {
+    void sort(Compare compare, Sort algo = Sort{}, Args &&...args) const {
         auto *cpool = std::get<0>(pools);
 
         if constexpr(sizeof...(Component) == 0) {
@@ -940,7 +924,7 @@ public:
             cpool->sort_n(*length, std::move(comp), std::move(algo), std::forward<Args>(args)...);
         }
 
-        [this](auto *head, auto *... other) {
+        [this](auto *head, auto *...other) {
             for(auto next = *length; next; --next) {
                 const auto pos = next - 1;
                 [[maybe_unused]] const auto entt = head->data()[pos];
@@ -951,11 +935,9 @@ public:
 
 private:
     const std::tuple<storage_type<Owned> *..., storage_type<Get> *...> pools;
-    const size_type * const length;
+    const size_type *const length;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 11 - 20
src/entt/entity/handle.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_ENTITY_HANDLE_HPP
 #define ENTT_ENTITY_HANDLE_HPP
 
-
 #include <tuple>
 #include <type_traits>
 #include <utility>
@@ -10,10 +9,8 @@
 #include "fwd.hpp"
 #include "registry.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Non-owning handle to an entity.
  *
@@ -35,8 +32,8 @@ struct basic_handle {
 
     /*! @brief Constructs an invalid handle. */
     basic_handle() ENTT_NOEXCEPT
-        : reg{}, entt{null}
-    {}
+        : reg{},
+          entt{null} {}
 
     /**
      * @brief Constructs a handle from a given registry and entity.
@@ -44,8 +41,8 @@ struct basic_handle {
      * @param value A valid identifier.
      */
     basic_handle(registry_type &ref, entity_type value) ENTT_NOEXCEPT
-        : reg{&ref}, entt{value}
-    {}
+        : reg{&ref},
+          entt{value} {}
 
     /**
      * @brief Constructs a const handle from a non-const one.
@@ -90,7 +87,7 @@ struct basic_handle {
      * @brief Returns a pointer to the underlying registry, if any.
      * @return A pointer to the underlying registry, if any.
      */
-    [[nodiscard]] registry_type * registry() const ENTT_NOEXCEPT {
+    [[nodiscard]] registry_type *registry() const ENTT_NOEXCEPT {
         return reg;
     }
 
@@ -128,7 +125,7 @@ struct basic_handle {
      * @return A reference to the newly created component.
      */
     template<typename Component, typename... Args>
-    decltype(auto) emplace(Args &&... args) const {
+    decltype(auto) emplace(Args &&...args) const {
         static_assert(((sizeof...(Type) == 0) || ... || std::is_same_v<Component, Type>), "Invalid type");
         return reg->template emplace<Component>(entt, std::forward<Args>(args)...);
     }
@@ -142,7 +139,7 @@ struct basic_handle {
      * @return A reference to the newly created component.
      */
     template<typename Component, typename... Args>
-    decltype(auto) emplace_or_replace(Args &&... args) const {
+    decltype(auto) emplace_or_replace(Args &&...args) const {
         static_assert(((sizeof...(Type) == 0) || ... || std::is_same_v<Component, Type>), "Invalid type");
         return reg->template emplace_or_replace<Component>(entt, std::forward<Args>(args)...);
     }
@@ -156,7 +153,7 @@ struct basic_handle {
      * @return A reference to the patched component.
      */
     template<typename Component, typename... Func>
-    decltype(auto) patch(Func &&... func) const {
+    decltype(auto) patch(Func &&...func) const {
         static_assert(((sizeof...(Type) == 0) || ... || std::is_same_v<Component, Type>), "Invalid type");
         return reg->template patch<Component>(entt, std::forward<Func>(func)...);
     }
@@ -170,7 +167,7 @@ struct basic_handle {
      * @return A reference to the component being replaced.
      */
     template<typename Component, typename... Args>
-    decltype(auto) replace(Args &&... args) const {
+    decltype(auto) replace(Args &&...args) const {
         static_assert(((sizeof...(Type) == 0) || ... || std::is_same_v<Component, Type>), "Invalid type");
         return reg->template replace<Component>(entt, std::forward<Args>(args)...);
     }
@@ -242,7 +239,7 @@ struct basic_handle {
      * @return Reference to the component owned by the handle.
      */
     template<typename Component, typename... Args>
-    [[nodiscard]] decltype(auto) get_or_emplace(Args &&... args) const {
+    [[nodiscard]] decltype(auto) get_or_emplace(Args &&...args) const {
         static_assert(((sizeof...(Type) == 0) || ... || std::is_same_v<Component, Type>), "Invalid type");
         return reg->template get_or_emplace<Component>(entt, std::forward<Args>(args)...);
     }
@@ -283,7 +280,6 @@ private:
     entity_type entt;
 };
 
-
 /**
  * @brief Compares two handles.
  * @tparam Args Scope of the first handle.
@@ -298,7 +294,6 @@ template<typename... Args, typename... Other>
     return lhs.registry() == rhs.registry() && lhs.entity() == rhs.entity();
 }
 
-
 /**
  * @brief Compares two handles.
  * @tparam Args Scope of the first handle.
@@ -313,7 +308,6 @@ template<typename... Args, typename... Other>
     return !(lhs == rhs);
 }
 
-
 /**
  * @brief Deduction guide.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -321,7 +315,6 @@ template<typename... Args, typename... Other>
 template<typename Entity>
 basic_handle(basic_registry<Entity> &, Entity) -> basic_handle<Entity>;
 
-
 /**
  * @brief Deduction guide.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -329,8 +322,6 @@ basic_handle(basic_registry<Entity> &, Entity) -> basic_handle<Entity>;
 template<typename Entity>
 basic_handle(const basic_registry<Entity> &, Entity) -> basic_handle<const Entity>;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 2 - 15
src/entt/entity/helper.hpp

@@ -1,19 +1,16 @@
 #ifndef ENTT_ENTITY_HELPER_HPP
 #define ENTT_ENTITY_HELPER_HPP
 
-
 #include <type_traits>
 #include "../config/config.h"
 #include "../core/fwd.hpp"
 #include "../core/type_traits.hpp"
 #include "../signal/delegate.hpp"
-#include "registry.hpp"
 #include "fwd.hpp"
-
+#include "registry.hpp"
 
 namespace entt {
 
-
 /**
  * @brief Converts a registry to a view.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -46,7 +43,6 @@ private:
     registry_type &reg;
 };
 
-
 /**
  * @brief Deduction guide.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -54,7 +50,6 @@ private:
 template<typename Entity>
 as_view(basic_registry<Entity> &) -> as_view<Entity>;
 
-
 /**
  * @brief Deduction guide.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -62,7 +57,6 @@ as_view(basic_registry<Entity> &) -> as_view<Entity>;
 template<typename Entity>
 as_view(const basic_registry<Entity> &) -> as_view<const Entity>;
 
-
 /**
  * @brief Converts a registry to a group.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -100,7 +94,6 @@ private:
     registry_type &reg;
 };
 
-
 /**
  * @brief Deduction guide.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -108,7 +101,6 @@ private:
 template<typename Entity>
 as_group(basic_registry<Entity> &) -> as_group<Entity>;
 
-
 /**
  * @brief Deduction guide.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -116,8 +108,6 @@ as_group(basic_registry<Entity> &) -> as_group<Entity>;
 template<typename Entity>
 as_group(const basic_registry<Entity> &) -> as_group<const Entity>;
 
-
-
 /**
  * @brief Helper to create a listener that directly invokes a member function.
  * @tparam Member Member function to invoke on a component of the given type.
@@ -133,7 +123,6 @@ void invoke(basic_registry<Entity> &reg, const Entity entt) {
     func(reg, entt);
 }
 
-
 /**
  * @brief Returns the entity associated with a given component.
  *
@@ -161,8 +150,6 @@ Entity to_entity(const basic_registry<Entity> &reg, const Component &instance) {
     return null;
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 10 - 21
src/entt/entity/observer.hpp

@@ -1,30 +1,26 @@
 #ifndef ENTT_ENTITY_OBSERVER_HPP
 #define ENTT_ENTITY_OBSERVER_HPP
 
-
-#include <limits>
 #include <cstddef>
 #include <cstdint>
-#include <utility>
+#include <limits>
 #include <type_traits>
+#include <utility>
 #include "../config/config.h"
 #include "../core/type_traits.hpp"
 #include "../signal/delegate.hpp"
+#include "entity.hpp"
+#include "fwd.hpp"
 #include "registry.hpp"
 #include "storage.hpp"
 #include "utility.hpp"
-#include "entity.hpp"
-#include "fwd.hpp"
-
 
 namespace entt {
 
-
 /*! @brief Grouping matcher. */
 template<typename...>
 struct matcher {};
 
-
 /**
  * @brief Collector.
  *
@@ -34,7 +30,6 @@ struct matcher {};
 template<typename...>
 struct basic_collector;
 
-
 /**
  * @brief Collector.
  *
@@ -114,11 +109,9 @@ struct basic_collector<matcher<type_list<Reject...>, type_list<Require...>, Rule
     }
 };
 
-
 /*! @brief Variable template used to ease the definition of collectors. */
 inline constexpr basic_collector<> collector{};
 
-
 /**
  * @brief Observer.
  *
@@ -282,8 +275,7 @@ public:
     /*! @brief Default constructor. */
     basic_observer()
         : release{},
-          storage{}
-    {}
+          storage{} {}
 
     /*! @brief Default copy constructor, deleted on purpose. */
     basic_observer(const basic_observer &) = delete;
@@ -297,8 +289,7 @@ public:
      */
     template<typename... Matcher>
     basic_observer(basic_registry<entity_type> &reg, basic_collector<Matcher...>)
-        : basic_observer{}
-    {
+        : basic_observer{} {
         connect<Matcher...>(reg, std::index_sequence_for<Matcher...>{});
     }
 
@@ -309,13 +300,13 @@ public:
      * @brief Default copy assignment operator, deleted on purpose.
      * @return This observer.
      */
-    basic_observer & operator=(const basic_observer &) = delete;
+    basic_observer &operator=(const basic_observer &) = delete;
 
     /**
      * @brief Default move assignment operator, deleted on purpose.
      * @return This observer.
      */
-    basic_observer & operator=(basic_observer &&) = delete;
+    basic_observer &operator=(basic_observer &&) = delete;
 
     /**
      * @brief Connects an observer to a given registry.
@@ -365,7 +356,7 @@ public:
      *
      * @return A pointer to the array of entities.
      */
-    [[nodiscard]] const entity_type * data() const ENTT_NOEXCEPT {
+    [[nodiscard]] const entity_type *data() const ENTT_NOEXCEPT {
         return storage.data();
     }
 
@@ -440,8 +431,6 @@ private:
     basic_storage<entity_type, payload_type> storage;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 22 - 43
src/entt/entity/organizer.hpp

@@ -1,9 +1,8 @@
 #ifndef ENTT_ENTITY_ORGANIZER_HPP
 #define ENTT_ENTITY_ORGANIZER_HPP
 
-
-#include <cstddef>
 #include <algorithm>
+#include <cstddef>
 #include <type_traits>
 #include <unordered_map>
 #include <utility>
@@ -13,19 +12,15 @@
 #include "fwd.hpp"
 #include "helper.hpp"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename>
 struct is_view: std::false_type {};
 
@@ -35,20 +30,17 @@ struct is_view<basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>>>:
 template<typename Type>
 inline constexpr bool is_view_v = is_view<Type>::value;
 
-
 template<typename Type, typename Override>
 struct unpack_type {
     using ro = std::conditional_t<
         type_list_contains_v<Override, std::add_const_t<Type>> || (std::is_const_v<Type> && !type_list_contains_v<Override, std::remove_const_t<Type>>),
         type_list<std::remove_const_t<Type>>,
-        type_list<>
-    >;
+        type_list<>>;
 
     using rw = std::conditional_t<
         type_list_contains_v<Override, std::remove_const_t<Type>> || (!std::is_const_v<Type> && !type_list_contains_v<Override, std::add_const_t<Type>>),
         type_list<Type>,
-        type_list<>
-    >;
+        type_list<>>;
 };
 
 template<typename Entity, typename... Override>
@@ -59,8 +51,7 @@ struct unpack_type<basic_registry<Entity>, type_list<Override...>> {
 
 template<typename Entity, typename... Override>
 struct unpack_type<const basic_registry<Entity>, type_list<Override...>>
-    : unpack_type<basic_registry<Entity>, type_list<Override...>>
-{};
+    : unpack_type<basic_registry<Entity>, type_list<Override...>> {};
 
 template<typename Entity, typename... Component, typename... Exclude, typename... Override>
 struct unpack_type<basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>>, type_list<Override...>> {
@@ -70,9 +61,7 @@ struct unpack_type<basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>
 
 template<typename Entity, typename... Component, typename... Exclude, typename... Override>
 struct unpack_type<const basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>>, type_list<Override...>>
-    : unpack_type<basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>>, type_list<Override...>>
-{};
-
+    : unpack_type<basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>>, type_list<Override...>> {};
 
 template<typename, typename>
 struct resource;
@@ -84,32 +73,28 @@ struct resource<type_list<Args...>, type_list<Req...>> {
     using rw = type_list_cat_t<typename unpack_type<Args, type_list<Req...>>::rw..., typename unpack_type<Req, type_list<>>::rw...>;
 };
 
-
 template<typename... Req, typename Ret, typename... Args>
-resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> free_function_to_resource(Ret(*)(Args...));
+resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> free_function_to_resource(Ret (*)(Args...));
 
 template<typename... Req, typename Ret, typename Type, typename... Args>
-resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> constrained_function_to_resource(Ret(*)(Type &, Args...));
+resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> constrained_function_to_resource(Ret (*)(Type &, Args...));
 
 template<typename... Req, typename Ret, typename Class, typename... Args>
-resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> constrained_function_to_resource(Ret(Class:: *)(Args...));
+resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> constrained_function_to_resource(Ret (Class::*)(Args...));
 
 template<typename... Req, typename Ret, typename Class, typename... Args>
-resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> constrained_function_to_resource(Ret(Class:: *)(Args...) const);
+resource<type_list<std::remove_reference_t<Args>...>, type_list<Req...>> constrained_function_to_resource(Ret (Class::*)(Args...) const);
 
 template<typename... Req>
 resource<type_list<>, type_list<Req...>> to_resource();
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Utility class for creating a static task graph.
  *
@@ -262,8 +247,7 @@ public:
         vertex(const bool vtype, vertex_data data, std::vector<std::size_t> edges)
             : is_top_level{vtype},
               node{std::move(data)},
-              reachable{std::move(edges)}
-        {}
+              reachable{std::move(edges)} {}
 
         /**
          * @brief Fills a buffer with the type info objects for the writable
@@ -323,7 +307,7 @@ public:
          * @brief Returns a user defined name associated with a vertex, if any.
          * @return The user defined name associated with the vertex, if any.
          */
-        const char * name() const ENTT_NOEXCEPT {
+        const char *name() const ENTT_NOEXCEPT {
             return node.name;
         }
 
@@ -331,7 +315,7 @@ public:
          * @brief Returns the function associated with a vertex.
          * @return The function associated with the vertex.
          */
-        function_type * callback() const ENTT_NOEXCEPT {
+        function_type *callback() const ENTT_NOEXCEPT {
             return node.callback;
         }
 
@@ -339,7 +323,7 @@ public:
          * @brief Returns the payload associated with a vertex, if any.
          * @return The payload associated with the vertex, if any.
          */
-        const void * data() const ENTT_NOEXCEPT {
+        const void *data() const ENTT_NOEXCEPT {
             return node.payload;
         }
 
@@ -347,7 +331,7 @@ public:
          * @brief Returns the list of nodes reachable from a given vertex.
          * @return The list of nodes reachable from the vertex.
          */
-        const std::vector<std::size_t> & children() const ENTT_NOEXCEPT {
+        const std::vector<std::size_t> &children() const ENTT_NOEXCEPT {
             return reachable;
         }
 
@@ -381,7 +365,7 @@ public:
             std::apply(Candidate, to_args(reg, typename resource_type::args{}));
         };
 
-        vertex_data vdata {
+        vertex_data vdata{
             resource_type::ro::size,
             resource_type::rw::size,
             name,
@@ -389,8 +373,7 @@ public:
             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{})); },
-            type_id<std::integral_constant<decltype(Candidate), Candidate>>()
-        };
+            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));
@@ -415,7 +398,7 @@ public:
             std::apply(Candidate, std::tuple_cat(std::forward_as_tuple(*curr), to_args(reg, typename resource_type::args{})));
         };
 
-        vertex_data vdata {
+        vertex_data vdata{
             resource_type::ro::size,
             resource_type::rw::size,
             name,
@@ -423,8 +406,7 @@ public:
             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{})); },
-            type_id<std::integral_constant<decltype(Candidate), Candidate>>()
-        };
+            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));
@@ -443,7 +425,7 @@ public:
         using resource_type = internal::resource<type_list<>, type_list<Req...>>;
         track_dependencies(vertices.size(), true, typename resource_type::ro{}, typename resource_type::rw{});
 
-        vertex_data vdata {
+        vertex_data vdata{
             resource_type::ro::size,
             resource_type::rw::size,
             name,
@@ -451,8 +433,7 @@ public:
             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); },
             nullptr,
-            type_info{}
-        };
+            type_info{}};
 
         vertices.push_back(std::move(vdata));
     }
@@ -500,8 +481,6 @@ private:
     std::vector<vertex_data> vertices;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 7
src/entt/entity/poly_storage.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_ENTITY_POLY_STORAGE_HPP
 #define ENTT_ENTITY_POLY_STORAGE_HPP
 
-
 #include <cstddef>
 #include <tuple>
 #include "../core/type_info.hpp"
@@ -9,10 +8,8 @@
 #include "../poly/poly.hpp"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Basic poly storage implementation.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -42,7 +39,6 @@ struct Storage: type_list<type_info() const ENTT_NOEXCEPT> {
     using impl = value_list<&type_id<typename Type::value_type>>;
 };
 
-
 /**
  * @brief Defines the poly storage type associate with a given entity type.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -53,8 +49,6 @@ struct poly_storage_traits {
     using storage_type = poly<Storage<Entity>>;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 44 - 49
src/entt/entity/registry.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_ENTITY_REGISTRY_HPP
 #define ENTT_ENTITY_REGISTRY_HPP
 
-
 #include <algorithm>
 #include <cstddef>
 #include <iterator>
@@ -27,10 +26,8 @@
 #include "utility.hpp"
 #include "view.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Fast and reliable entity-component system.
  *
@@ -69,8 +66,8 @@ class basic_registry {
             [[maybe_unused]] const auto cpools = std::make_tuple(owner.assure<Owned>()...);
 
             const auto is_valid = ((std::is_same_v<Component, Owned> || std::get<storage_type<Owned> *>(cpools)->contains(entt)) && ...)
-                    && ((std::is_same_v<Component, Get> || owner.assure<Get>()->contains(entt)) && ...)
-                    && ((std::is_same_v<Component, Exclude> || !owner.assure<Exclude>()->contains(entt)) && ...);
+                                  && ((std::is_same_v<Component, Get> || owner.assure<Get>()->contains(entt)) && ...)
+                                  && ((std::is_same_v<Component, Exclude> || !owner.assure<Exclude>()->contains(entt)) && ...);
 
             if constexpr(sizeof...(Owned) == 0) {
                 if(is_valid && !current.contains(entt)) {
@@ -98,19 +95,19 @@ class basic_registry {
 
     struct group_data {
         std::size_t size;
-        std::unique_ptr<void, void(*)(void *)> group;
-        bool (* owned)(const id_type) ENTT_NOEXCEPT;
-        bool (* get)(const id_type) ENTT_NOEXCEPT;
-        bool (* exclude)(const id_type) ENTT_NOEXCEPT;
+        std::unique_ptr<void, void (*)(void *)> group;
+        bool (*owned)(const id_type) ENTT_NOEXCEPT;
+        bool (*get)(const id_type) ENTT_NOEXCEPT;
+        bool (*exclude)(const id_type) ENTT_NOEXCEPT;
     };
 
     template<typename Component>
-    [[nodiscard]] storage_type<Component> * assure() const {
+    [[nodiscard]] storage_type<Component> *assure() const {
         static_assert(std::is_same_v<Component, std::decay_t<Component>>, "Non-decayed types not allowed");
         const auto index = type_index<Component>::value();
 
         if(!(index < pools.size())) {
-            pools.resize(size_type(index)+1u);
+            pools.resize(size_type(index) + 1u);
         }
 
         if(auto &&pdata = pools[index]; !pdata.pool) {
@@ -122,7 +119,7 @@ class basic_registry {
     }
 
     template<typename Component>
-    [[nodiscard]] const storage_type<Component> * pool_if_exists() const ENTT_NOEXCEPT {
+    [[nodiscard]] const storage_type<Component> *pool_if_exists() const ENTT_NOEXCEPT {
         static_assert(std::is_same_v<Component, std::decay_t<Component>>, "Non-decayed types not allowed");
         const auto index = type_index<Component>::value();
         return (!(index < pools.size()) || !pools[index].pool) ? nullptr : static_cast<const storage_type<Component> *>(pools[index].pool.get());
@@ -164,7 +161,7 @@ public:
     basic_registry(basic_registry &&) = default;
 
     /*! @brief Default move assignment operator. @return This registry. */
-    basic_registry & operator=(basic_registry &&) = default;
+    basic_registry &operator=(basic_registry &&) = default;
 
     /**
      * @brief Prepares a pool for the given type if required.
@@ -182,13 +179,13 @@ public:
      * @return A valid poly storage if a pool for the given type exists, an
      * empty and thus invalid element otherwise.
      */
-    poly_storage & storage(const type_info info) {
+    poly_storage &storage(const type_info info) {
         ENTT_ASSERT(info.index() < pools.size() && pools[info.index()].poly, "Storage not available");
         return pools[info.index()].poly;
     }
 
     /*! @copydoc storage */
-    const poly_storage & storage(const type_info info) const {
+    const poly_storage &storage(const type_info info) const {
         ENTT_ASSERT(info.index() < pools.size() && pools[info.index()].poly, "Storage not available");
         return pools[info.index()].poly;
     }
@@ -294,7 +291,7 @@ public:
         if constexpr(sizeof...(Component) == 0) {
             return !alive();
         } else {
-            return [](const auto *... cpool) { return ((!cpool || cpool->empty()) && ...); }(pool_if_exists<Component>()...);
+            return [](const auto *...cpool) { return ((!cpool || cpool->empty()) && ...); }(pool_if_exists<Component>()...);
         }
     }
 
@@ -310,7 +307,7 @@ public:
      *
      * @return A pointer to the array of entities.
      */
-    [[nodiscard]] const entity_type * data() const ENTT_NOEXCEPT {
+    [[nodiscard]] const entity_type *data() const ENTT_NOEXCEPT {
         return entities.data();
     }
 
@@ -525,7 +522,7 @@ public:
         ENTT_ASSERT(valid(entity), "Invalid entity");
 
         for(auto &&pdata: pools) {
-            pdata.pool && pdata.pool->remove(entity, this);
+            pdata.pool &&pdata.pool->remove(entity, this);
         }
 
         return release_entity(entity, version);
@@ -548,7 +545,7 @@ public:
             }
         } else {
             for(auto &&pdata: pools) {
-                pdata.pool && pdata.pool->remove(first, last, this);
+                pdata.pool &&pdata.pool->remove(first, last, this);
             }
 
             release(first, last);
@@ -573,7 +570,7 @@ public:
      * @return A reference to the newly created component.
      */
     template<typename Component, typename... Args>
-    decltype(auto) emplace(const entity_type entity, Args &&... args) {
+    decltype(auto) emplace(const entity_type entity, Args &&...args) {
         ENTT_ASSERT(valid(entity), "Invalid entity");
         return assure<Component>()->emplace(*this, entity, std::forward<Args>(args)...);
     }
@@ -635,13 +632,13 @@ public:
      * @return A reference to the newly created component.
      */
     template<typename Component, typename... Args>
-    decltype(auto) emplace_or_replace(const entity_type entity, Args &&... args) {
+    decltype(auto) emplace_or_replace(const entity_type entity, Args &&...args) {
         ENTT_ASSERT(valid(entity), "Invalid entity");
         auto *cpool = assure<Component>();
 
         return cpool->contains(entity)
-            ? cpool->patch(*this, entity, [&args...](auto &... curr) { ((curr = Component{std::forward<Args>(args)...}), ...); })
-            : cpool->emplace(*this, entity, std::forward<Args>(args)...);
+                   ? cpool->patch(*this, entity, [&args...](auto &...curr) { ((curr = Component{std::forward<Args>(args)...}), ...); })
+                   : cpool->emplace(*this, entity, std::forward<Args>(args)...);
     }
 
     /**
@@ -669,7 +666,7 @@ public:
      * @return A reference to the patched component.
      */
     template<typename Component, typename... Func>
-    decltype(auto) patch(const entity_type entity, Func &&... func) {
+    decltype(auto) patch(const entity_type entity, Func &&...func) {
         ENTT_ASSERT(valid(entity), "Invalid entity");
         return assure<Component>()->patch(*this, entity, std::forward<Func>(func)...);
     }
@@ -692,8 +689,8 @@ public:
      * @return A reference to the component being replaced.
      */
     template<typename Component, typename... Args>
-    decltype(auto) replace(const entity_type entity, Args &&... args) {
-        return assure<Component>()->patch(*this, entity, [&args...](auto &... curr) { ((curr = Component{std::forward<Args>(args)...}), ...); });
+    decltype(auto) replace(const entity_type entity, Args &&...args) {
+        return assure<Component>()->patch(*this, entity, [&args...](auto &...curr) { ((curr = Component{std::forward<Args>(args)...}), ...); });
     }
 
     /**
@@ -807,7 +804,7 @@ public:
     template<typename... Component>
     [[nodiscard]] bool all_of(const entity_type entity) const {
         ENTT_ASSERT(valid(entity), "Invalid entity");
-        return [entity](const auto *... cpool) { return ((cpool && cpool->contains(entity)) && ...); }(pool_if_exists<Component>()...);
+        return [entity](const auto *...cpool) { return ((cpool && cpool->contains(entity)) && ...); }(pool_if_exists<Component>()...);
     }
 
     /**
@@ -824,7 +821,7 @@ public:
     template<typename... Component>
     [[nodiscard]] bool any_of(const entity_type entity) const {
         ENTT_ASSERT(valid(entity), "Invalid entity");
-        return [entity](const auto *... cpool) { return !((!cpool || !cpool->contains(entity)) && ...); }(pool_if_exists<Component>()...);
+        return [entity](const auto *...cpool) { return !((!cpool || !cpool->contains(entity)) && ...); }(pool_if_exists<Component>()...);
     }
 
     /**
@@ -886,7 +883,7 @@ public:
      * @return Reference to the component owned by the entity.
      */
     template<typename Component, typename... Args>
-    [[nodiscard]] decltype(auto) get_or_emplace(const entity_type entity, Args &&... args) {
+    [[nodiscard]] decltype(auto) get_or_emplace(const entity_type entity, Args &&...args) {
         ENTT_ASSERT(valid(entity), "Invalid entity");
         auto *cpool = assure<Component>();
         return cpool->contains(entity) ? cpool->get(entity) : cpool->emplace(*this, entity, std::forward<Args>(args)...);
@@ -967,7 +964,7 @@ public:
     void each(Func func) const {
         if(free_list == null) {
             for(auto pos = entities.size(); pos; --pos) {
-                func(entities[pos-1]);
+                func(entities[pos - 1]);
             }
         } else {
             for(auto pos = entities.size(); pos; --pos) {
@@ -1121,14 +1118,14 @@ public:
     template<typename... Component, typename... Exclude>
     [[nodiscard]] basic_view<Entity, get_t<std::add_const_t<Component>...>, exclude_t<Exclude...>> view(exclude_t<Exclude...> = {}) const {
         static_assert(sizeof...(Component) > 0, "Exclusion-only views are not supported");
-        return { *assure<std::remove_const_t<Component>>()..., *assure<Exclude>()... };
+        return {*assure<std::remove_const_t<Component>>()..., *assure<Exclude>()...};
     }
 
     /*! @copydoc view */
     template<typename... Component, typename... Exclude>
     [[nodiscard]] basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>> view(exclude_t<Exclude...> = {}) {
         static_assert(sizeof...(Component) > 0, "Exclusion-only views are not supported");
-        return { *assure<std::remove_const_t<Component>>()..., *assure<Exclude>()... };
+        return {*assure<std::remove_const_t<Component>>()..., *assure<Exclude>()...};
     }
 
     /**
@@ -1174,7 +1171,7 @@ public:
             return it == pools.cend() ? nullptr : it->pool.get();
         });
 
-        return { std::move(component), std::move(filter) };
+        return {std::move(component), std::move(filter)};
     }
 
     /**
@@ -1227,7 +1224,7 @@ public:
         } else {
             group_data candidate = {
                 size,
-                { new handler_type{}, [](void *instance) { delete static_cast<handler_type *>(instance); } },
+                {new handler_type{}, [](void *instance) { delete static_cast<handler_type *>(instance); }},
                 []([[maybe_unused]] const id_type ctype) ENTT_NOEXCEPT { return ((ctype == type_hash<std::remove_const_t<Owned>>::value()) || ...); },
                 []([[maybe_unused]] const id_type ctype) ENTT_NOEXCEPT { return ((ctype == type_hash<std::remove_const_t<Get>>::value()) || ...); },
                 []([[maybe_unused]] const id_type ctype) ENTT_NOEXCEPT { return ((ctype == type_hash<Exclude>::value()) || ...); },
@@ -1282,7 +1279,7 @@ public:
             }
         }
 
-        return { handler->current, *std::get<storage_type<std::remove_const_t<Owned>> *>(cpools)..., *std::get<storage_type<std::remove_const_t<Get>> *>(cpools)... };
+        return {handler->current, *std::get<storage_type<std::remove_const_t<Owned>> *>(cpools)..., *std::get<storage_type<std::remove_const_t<Get>> *>(cpools)...};
     }
 
     /**
@@ -1308,7 +1305,7 @@ public:
             return {};
         } else {
             using handler_type = group_handler<exclude_t<Exclude...>, get_t<std::remove_const_t<Get>...>, std::remove_const_t<Owned>...>;
-            return { static_cast<handler_type *>(it->group.get())->current, *pool_if_exists<std::remove_const_t<Owned>>()... , *pool_if_exists<std::remove_const_t<Get>>()... };
+            return {static_cast<handler_type *>(it->group.get())->current, *pool_if_exists<std::remove_const_t<Owned>>()..., *pool_if_exists<std::remove_const_t<Get>>()...};
         }
     }
 
@@ -1411,7 +1408,7 @@ public:
      * @param args Arguments to forward to the sort function object, if any.
      */
     template<typename Component, typename Compare, typename Sort = std_sort, typename... Args>
-    void sort(Compare compare, Sort algo = Sort{}, Args &&... args) {
+    void sort(Compare compare, Sort algo = Sort{}, Args &&...args) {
         ENTT_ASSERT(sortable<Component>(), "Cannot sort owned storage");
         auto *cpool = assure<Component>();
 
@@ -1490,7 +1487,7 @@ public:
     template<typename Func>
     void visit(entity_type entity, Func func) const {
         for(auto pos = pools.size(); pos; --pos) {
-            if(const auto &pdata = pools[pos-1]; pdata.pool && pdata.pool->contains(entity)) {
+            if(const auto &pdata = pools[pos - 1]; pdata.pool && pdata.pool->contains(entity)) {
                 func(pdata.poly->value_type());
             }
         }
@@ -1519,7 +1516,7 @@ public:
     template<typename Func>
     void visit(Func func) const {
         for(auto pos = pools.size(); pos; --pos) {
-            if(const auto &pdata = pools[pos-1]; pdata.pool) {
+            if(const auto &pdata = pools[pos - 1]; pdata.pool) {
                 func(pdata.poly->value_type());
             }
         }
@@ -1537,7 +1534,7 @@ public:
      * @return A reference to the newly created object.
      */
     template<typename Type, typename... Args>
-    Type & set(Args &&... args) {
+    Type &set(Args &&...args) {
         unset<Type>();
         vars.emplace_back(std::in_place_type<Type>, std::forward<Args>(args)...);
         return any_cast<Type &>(vars.back());
@@ -1564,7 +1561,7 @@ public:
      * @return A reference to the object in the context of the registry.
      */
     template<typename Type, typename... Args>
-    [[nodiscard]] Type & ctx_or_set(Args &&... args) {
+    [[nodiscard]] Type &ctx_or_set(Args &&...args) {
         auto *value = try_ctx<Type>();
         return value ? *value : set<Type>(std::forward<Args>(args)...);
     }
@@ -1576,14 +1573,14 @@ public:
      * registry, a null pointer otherwise.
      */
     template<typename Type>
-    [[nodiscard]] std::add_const_t<Type> * try_ctx() const {
+    [[nodiscard]] std::add_const_t<Type> *try_ctx() const {
         auto it = std::find_if(vars.cbegin(), vars.cend(), [type = type_id<Type>()](auto &&var) { return var.type() == type; });
         return it == vars.cend() ? nullptr : any_cast<std::add_const_t<Type>>(&*it);
     }
 
     /*! @copydoc try_ctx */
     template<typename Type>
-    [[nodiscard]] Type * try_ctx() {
+    [[nodiscard]] Type *try_ctx() {
         auto it = std::find_if(vars.begin(), vars.end(), [type = type_id<Type>()](auto &&var) { return var.type() == type; });
         return it == vars.end() ? nullptr : any_cast<Type>(&*it);
     }
@@ -1599,7 +1596,7 @@ public:
      * @return A valid reference to the object in the context of the registry.
      */
     template<typename Type>
-    [[nodiscard]] std::add_const_t<Type> & ctx() const {
+    [[nodiscard]] std::add_const_t<Type> &ctx() const {
         auto it = std::find_if(vars.cbegin(), vars.cend(), [type = type_id<Type>()](auto &&var) { return var.type() == type; });
         ENTT_ASSERT(it != vars.cend(), "Invalid instance");
         return any_cast<std::add_const_t<Type> &>(*it);
@@ -1607,7 +1604,7 @@ public:
 
     /*! @copydoc ctx */
     template<typename Type>
-    [[nodiscard]] Type & ctx() {
+    [[nodiscard]] Type &ctx() {
         auto it = std::find_if(vars.begin(), vars.end(), [type = type_id<Type>()](auto &&var) { return var.type() == type; });
         ENTT_ASSERT(it != vars.end(), "Invalid instance");
         return any_cast<Type &>(*it);
@@ -1637,7 +1634,7 @@ public:
     template<typename Func>
     void ctx(Func func) const {
         for(auto pos = vars.size(); pos; --pos) {
-            func(vars[pos-1].type());
+            func(vars[pos - 1].type());
         }
     }
 
@@ -1649,8 +1646,6 @@ private:
     entity_type free_list{tombstone};
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 13 - 21
src/entt/entity/runtime_view.hpp

@@ -1,21 +1,18 @@
 #ifndef ENTT_ENTITY_RUNTIME_VIEW_HPP
 #define ENTT_ENTITY_RUNTIME_VIEW_HPP
 
-
-#include <iterator>
-#include <vector>
-#include <utility>
 #include <algorithm>
+#include <iterator>
 #include <type_traits>
+#include <utility>
+#include <vector>
 #include "../config/config.h"
 #include "entity.hpp"
-#include "sparse_set.hpp"
 #include "fwd.hpp"
-
+#include "sparse_set.hpp"
 
 namespace entt {
 
-
 /**
  * @brief Runtime view.
  *
@@ -62,8 +59,8 @@ class basic_runtime_view final {
     class view_iterator final {
         [[nodiscard]] bool valid() const {
             return (no_tombstone_check || (*it != tombstone))
-                && std::all_of(pools->begin()++, pools->end(), [entt = *it](const auto *curr) { return curr->contains(entt); })
-                && std::none_of(filter->cbegin(), filter->cend(), [entt = *it](const auto *curr) { return curr && curr->contains(entt); });
+                   && std::all_of(pools->begin()++, pools->end(), [entt = *it](const auto *curr) { return curr->contains(entt); })
+                   && std::none_of(filter->cbegin(), filter->cend(), [entt = *it](const auto *curr) { return curr && curr->contains(entt); });
         }
 
     public:
@@ -79,14 +76,13 @@ class basic_runtime_view final {
             : pools{&cpools},
               filter{&ignore},
               it{curr},
-              no_tombstone_check{std::all_of(pools->cbegin(), pools->cend(), [](const basic_common_type *cpool) { return (cpool->policy() == deletion_policy::swap_and_pop); })}
-        {
+              no_tombstone_check{std::all_of(pools->cbegin(), pools->cend(), [](const basic_common_type *cpool) { return (cpool->policy() == deletion_policy::swap_and_pop); })} {
             if(it != (*pools)[0]->end() && !valid()) {
                 ++(*this);
             }
         }
 
-        view_iterator & operator++() {
+        view_iterator &operator++() {
             while(++it != (*pools)[0]->end() && !valid()) { continue; }
             return *this;
         }
@@ -96,7 +92,7 @@ class basic_runtime_view final {
             return ++(*this), orig;
         }
 
-        view_iterator & operator--() ENTT_NOEXCEPT {
+        view_iterator &operator--() ENTT_NOEXCEPT {
             while(--it != (*pools)[0]->begin() && !valid()) { continue; }
             return *this;
         }
@@ -144,8 +140,7 @@ public:
     /*! @brief Default constructor to use to create empty, invalid views. */
     basic_runtime_view() ENTT_NOEXCEPT
         : pools{},
-          filter{}
-    {}
+          filter{} {}
 
     /**
      * @brief Constructs a runtime view from a set of storage classes.
@@ -154,8 +149,7 @@ public:
      */
     basic_runtime_view(std::vector<const basic_common_type *> cpools, std::vector<const basic_common_type *> epools) ENTT_NOEXCEPT
         : pools{std::move(cpools)},
-          filter{std::move(epools)}
-    {
+          filter{std::move(epools)} {
         auto candidate = std::min_element(pools.begin(), pools.end(), [](const auto *lhs, const auto *rhs) {
             return (!lhs && rhs) || (lhs && rhs && lhs->size() < rhs->size());
         });
@@ -208,7 +202,7 @@ public:
      */
     [[nodiscard]] bool contains(const entity_type entt) const {
         return valid() && std::all_of(pools.cbegin(), pools.cend(), [entt](const auto *curr) { return curr->contains(entt); })
-                && std::none_of(filter.cbegin(), filter.cend(), [entt](const auto *curr) { return curr && curr->contains(entt); });
+               && std::none_of(filter.cbegin(), filter.cend(), [entt](const auto *curr) { return curr && curr->contains(entt); });
     }
 
     /**
@@ -238,8 +232,6 @@ private:
     std::vector<const basic_common_type *> filter;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 21 - 31
src/entt/entity/snapshot.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_ENTITY_SNAPSHOT_HPP
 #define ENTT_ENTITY_SNAPSHOT_HPP
 
-
 #include <array>
 #include <cstddef>
 #include <iterator>
@@ -16,10 +15,8 @@
 #include "fwd.hpp"
 #include "registry.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Utility class to create snapshots from a registry.
  *
@@ -70,14 +67,13 @@ public:
      * @param source A valid reference to a registry.
      */
     basic_snapshot(const basic_registry<entity_type> &source) ENTT_NOEXCEPT
-        : reg{&source}
-    {}
+        : reg{&source} {}
 
     /*! @brief Default move constructor. */
     basic_snapshot(basic_snapshot &&) = default;
 
     /*! @brief Default move assignment operator. @return This snapshot. */
-    basic_snapshot & operator=(basic_snapshot &&) = default;
+    basic_snapshot &operator=(basic_snapshot &&) = default;
 
     /**
      * @brief Puts aside all the entities from the underlying registry.
@@ -90,7 +86,7 @@ public:
      * @return An object of this type to continue creating the snapshot.
      */
     template<typename Archive>
-    const basic_snapshot & entities(Archive &archive) const {
+    const basic_snapshot &entities(Archive &archive) const {
         const auto sz = reg->size();
 
         archive(typename entity_traits::entity_type(sz + 1u));
@@ -115,7 +111,7 @@ public:
      * @return An object of this type to continue creating the snapshot.
      */
     template<typename... Component, typename Archive>
-    const basic_snapshot & component(Archive &archive) const {
+    const basic_snapshot &component(Archive &archive) const {
         if constexpr(sizeof...(Component) == 1u) {
             const auto view = reg->template view<const Component...>();
             (component<Component>(archive, view.data(), view.data() + view.size()), ...);
@@ -141,7 +137,7 @@ public:
      * @return An object of this type to continue creating the snapshot.
      */
     template<typename... Component, typename Archive, typename It>
-    const basic_snapshot & component(Archive &archive, It first, It last) const {
+    const basic_snapshot &component(Archive &archive, It first, It last) const {
         component<Component...>(archive, first, last, std::index_sequence_for<Component...>{});
         return *this;
     }
@@ -150,7 +146,6 @@ private:
     const basic_registry<entity_type> *reg;
 };
 
-
 /**
  * @brief Utility class to restore a snapshot as a whole.
  *
@@ -200,8 +195,7 @@ public:
      * @param source A valid reference to a registry.
      */
     basic_snapshot_loader(basic_registry<entity_type> &source) ENTT_NOEXCEPT
-        : reg{&source}
-    {
+        : reg{&source} {
         // restoring a snapshot as a whole requires a clean registry
         ENTT_ASSERT(reg->empty(), "Registry must be empty");
     }
@@ -210,7 +204,7 @@ public:
     basic_snapshot_loader(basic_snapshot_loader &&) = default;
 
     /*! @brief Default move assignment operator. @return This loader. */
-    basic_snapshot_loader & operator=(basic_snapshot_loader &&) = default;
+    basic_snapshot_loader &operator=(basic_snapshot_loader &&) = default;
 
     /**
      * @brief Restores entities that were in use during serialization.
@@ -223,7 +217,7 @@ public:
      * @return A valid loader to continue restoring data.
      */
     template<typename Archive>
-    const basic_snapshot_loader & entities(Archive &archive) const {
+    const basic_snapshot_loader &entities(Archive &archive) const {
         typename entity_traits::entity_type length{};
 
         archive(length);
@@ -252,7 +246,7 @@ public:
      * @return A valid loader to continue restoring data.
      */
     template<typename... Component, typename Archive>
-    const basic_snapshot_loader & component(Archive &archive) const {
+    const basic_snapshot_loader &component(Archive &archive) const {
         (assign<Component>(archive), ...);
         return *this;
     }
@@ -267,7 +261,7 @@ public:
      *
      * @return A valid loader to continue restoring data.
      */
-    const basic_snapshot_loader & orphans() const {
+    const basic_snapshot_loader &orphans() const {
         reg->orphans([this](const auto entt) {
             reg->release(entt);
         });
@@ -279,7 +273,6 @@ private:
     basic_registry<entity_type> *reg;
 };
 
-
 /**
  * @brief Utility class for _continuous loading_.
  *
@@ -326,7 +319,7 @@ class basic_continuous_loader {
 
     template<typename Container>
     auto update(int, Container &container)
-    -> decltype(typename Container::mapped_type{}, void()) {
+        -> decltype(typename Container::mapped_type{}, void()) {
         // map like container
         Container other;
 
@@ -349,7 +342,7 @@ class basic_continuous_loader {
 
     template<typename Container>
     auto update(char, Container &container)
-    -> decltype(typename Container::value_type{}, void()) {
+        -> decltype(typename Container::value_type{}, void()) {
         // vector like container
         static_assert(std::is_same_v<typename Container::value_type, entity_type>, "Invalid value type");
 
@@ -359,7 +352,7 @@ class basic_continuous_loader {
     }
 
     template<typename Other, typename Type, typename Member>
-    void update([[maybe_unused]] Other &instance, [[maybe_unused]] Member Type:: *member) {
+    void update([[maybe_unused]] Other &instance, [[maybe_unused]] Member Type::*member) {
         if constexpr(!std::is_same_v<Other, Type>) {
             return;
         } else if constexpr(std::is_same_v<Member, entity_type>) {
@@ -382,7 +375,7 @@ class basic_continuous_loader {
     }
 
     template<typename Other, typename Archive, typename... Type, typename... Member>
-    void assign(Archive &archive, [[maybe_unused]] Member Type:: *... member) {
+    void assign(Archive &archive, [[maybe_unused]] Member Type::*...member) {
         typename entity_traits::entity_type length{};
         archive(length);
 
@@ -415,14 +408,13 @@ public:
      * @param source A valid reference to a registry.
      */
     basic_continuous_loader(basic_registry<entity_type> &source) ENTT_NOEXCEPT
-        : reg{&source}
-    {}
+        : reg{&source} {}
 
     /*! @brief Default move constructor. */
     basic_continuous_loader(basic_continuous_loader &&) = default;
 
     /*! @brief Default move assignment operator. @return This loader. */
-    basic_continuous_loader & operator=(basic_continuous_loader &&) = default;
+    basic_continuous_loader &operator=(basic_continuous_loader &&) = default;
 
     /**
      * @brief Restores entities that were in use during serialization.
@@ -435,7 +427,7 @@ public:
      * @return A non-const reference to this loader.
      */
     template<typename Archive>
-    basic_continuous_loader & entities(Archive &archive) {
+    basic_continuous_loader &entities(Archive &archive) {
         typename entity_traits::entity_type length{};
         entity_type entt{};
 
@@ -476,7 +468,7 @@ public:
      * @return A non-const reference to this loader.
      */
     template<typename... Component, typename Archive, typename... Type, typename... Member>
-    basic_continuous_loader & component(Archive &archive, Member Type:: *... member) {
+    basic_continuous_loader &component(Archive &archive, Member Type::*...member) {
         (remove_if_exists<Component>(), ...);
         (assign<Component>(archive, member...), ...);
         return *this;
@@ -490,7 +482,7 @@ public:
      *
      * @return A non-const reference to this loader.
      */
-    basic_continuous_loader & shrink() {
+    basic_continuous_loader &shrink() {
         auto it = remloc.begin();
 
         while(it != remloc.cend()) {
@@ -522,7 +514,7 @@ public:
      *
      * @return A non-const reference to this loader.
      */
-    basic_continuous_loader & orphans() {
+    basic_continuous_loader &orphans() {
         reg->orphans([this](const auto entt) {
             reg->release(entt);
         });
@@ -560,8 +552,6 @@ private:
     basic_registry<entity_type> *reg;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 17 - 34
src/entt/entity/sparse_set.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_ENTITY_SPARSE_SET_HPP
 #define ENTT_ENTITY_SPARSE_SET_HPP
 
-
 #include <cstddef>
 #include <iterator>
 #include <memory>
@@ -14,19 +13,15 @@
 #include "entity.hpp"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename Traits>
 struct sparse_set_iterator final {
     using value_type = typename Traits::value_type;
@@ -39,10 +34,9 @@ struct sparse_set_iterator final {
 
     sparse_set_iterator(const pointer *ref, const difference_type idx) ENTT_NOEXCEPT
         : packed{ref},
-          index{idx}
-    {}
+          index{idx} {}
 
-    sparse_set_iterator & operator++() ENTT_NOEXCEPT {
+    sparse_set_iterator &operator++() ENTT_NOEXCEPT {
         return --index, *this;
     }
 
@@ -51,7 +45,7 @@ struct sparse_set_iterator final {
         return ++(*this), orig;
     }
 
-    sparse_set_iterator & operator--() ENTT_NOEXCEPT {
+    sparse_set_iterator &operator--() ENTT_NOEXCEPT {
         return ++index, *this;
     }
 
@@ -60,7 +54,7 @@ struct sparse_set_iterator final {
         return operator--(), orig;
     }
 
-    sparse_set_iterator & operator+=(const difference_type value) ENTT_NOEXCEPT {
+    sparse_set_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
         index -= value;
         return *this;
     }
@@ -70,7 +64,7 @@ struct sparse_set_iterator final {
         return (copy += value);
     }
 
-    sparse_set_iterator & operator-=(const difference_type value) ENTT_NOEXCEPT {
+    sparse_set_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
         return (*this += -value);
     }
 
@@ -124,25 +118,21 @@ private:
     difference_type index;
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /*! @brief Sparse set deletion policy. */
-enum class deletion_policy: std::uint8_t {
+enum class deletion_policy : std::uint8_t {
     /*! @brief Swap-and-pop deletion policy. */
     swap_and_pop = 0u,
     /*! @brief In-place deletion policy. */
     in_place = 1u
 };
 
-
 /**
  * @brief Basic sparse set implementation.
  *
@@ -190,7 +180,7 @@ class basic_sparse_set {
         return (page < bucket && sparse[page]) ? (sparse[page] + fast_mod<sparse_page_v>(pos)) : alloc_pointer{};
     }
 
-    [[nodiscard]] auto & sparse_ref(const Entity entt) const {
+    [[nodiscard]] auto &sparse_ref(const Entity entt) const {
         ENTT_ASSERT(sparse_ptr(entt), "Invalid element");
         const auto pos = static_cast<size_type>(entity_traits::to_entity(entt));
         return sparse[pos / sparse_page_v][fast_mod<sparse_page_v>(pos)];
@@ -341,16 +331,14 @@ public:
 
     /*! @brief Default constructor. */
     basic_sparse_set()
-        : basic_sparse_set{allocator_type{}}
-    {}
+        : basic_sparse_set{allocator_type{}} {}
 
     /**
      * @brief Constructs an empty container with a given allocator.
      * @param allocator The allocator to use.
      */
     explicit basic_sparse_set(const allocator_type &allocator)
-        : basic_sparse_set{deletion_policy::swap_and_pop, allocator}
-    {}
+        : basic_sparse_set{deletion_policy::swap_and_pop, allocator} {}
 
     /**
      * @brief Constructs an empty container with the given policy and allocator.
@@ -364,8 +352,7 @@ public:
           bucket{},
           count{},
           free_list{tombstone},
-          mode{pol}
-    {}
+          mode{pol} {}
 
     /**
      * @brief Move constructor.
@@ -378,8 +365,7 @@ public:
           bucket{std::exchange(other.bucket, size_type{})},
           count{std::exchange(other.count, size_type{})},
           free_list{std::exchange(other.free_list, tombstone)},
-          mode{other.mode}
-    {}
+          mode{other.mode} {}
 
     /**
      * @brief Allocator-extended move constructor.
@@ -393,8 +379,7 @@ public:
           bucket{std::exchange(other.bucket, size_type{})},
           count{std::exchange(other.count, size_type{})},
           free_list{std::exchange(other.free_list, tombstone)},
-          mode{other.mode}
-    {
+          mode{other.mode} {
         ENTT_ASSERT(alloc_traits::is_always_equal::value || reserved.first() == other.reserved.first(), "Copying a sparse set is not allowed");
     }
 
@@ -408,7 +393,7 @@ public:
      * @param other The instance to move from.
      * @return This sparse set.
      */
-    basic_sparse_set & operator=(basic_sparse_set &&other) ENTT_NOEXCEPT {
+    basic_sparse_set &operator=(basic_sparse_set &&other) ENTT_NOEXCEPT {
         release_memory();
         propagate_on_container_move_assignment(reserved.first(), other.reserved.first());
         ENTT_ASSERT(alloc_traits::is_always_equal::value || reserved.first() == other.reserved.first(), "Copying a sparse set is not allowed");
@@ -849,7 +834,7 @@ public:
      * @param args Arguments to forward to the sort function object, if any.
      */
     template<typename Compare, typename Sort = std_sort, typename... Args>
-    void sort_n(const size_type length, Compare compare, Sort algo = Sort{}, Args &&... args) {
+    void sort_n(const size_type length, Compare compare, Sort algo = Sort{}, Args &&...args) {
         // basic no-leak guarantee (with invalid state) if sorting throws
         ENTT_ASSERT(!(length > count), "Length exceeds the number of elements");
         compact();
@@ -885,7 +870,7 @@ public:
      * @param args Arguments to forward to the sort function object, if any.
      */
     template<typename Compare, typename Sort = std_sort, typename... Args>
-    void sort(Compare compare, Sort algo = Sort{}, Args &&... args) {
+    void sort(Compare compare, Sort algo = Sort{}, Args &&...args) {
         sort_n(count, std::move(compare), std::move(algo), std::forward<Args>(args)...);
     }
 
@@ -943,8 +928,6 @@ private:
     deletion_policy mode;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 37 - 56
src/entt/entity/storage.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_ENTITY_STORAGE_HPP
 #define ENTT_ENTITY_STORAGE_HPP
 
-
 #include <cstddef>
 #include <iterator>
 #include <memory>
@@ -19,19 +18,15 @@
 #include "fwd.hpp"
 #include "sparse_set.hpp"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename Traits>
 class storage_iterator final {
     static constexpr auto packed_page_v = ENTT_PACKED_PAGE;
@@ -50,10 +45,9 @@ public:
 
     storage_iterator(const data_pointer *ref, difference_type idx) ENTT_NOEXCEPT
         : packed{ref},
-          index{idx}
-    {}
+          index{idx} {}
 
-    storage_iterator & operator++() ENTT_NOEXCEPT {
+    storage_iterator &operator++() ENTT_NOEXCEPT {
         return --index, *this;
     }
 
@@ -62,7 +56,7 @@ public:
         return ++(*this), orig;
     }
 
-    storage_iterator & operator--() ENTT_NOEXCEPT {
+    storage_iterator &operator--() ENTT_NOEXCEPT {
         return ++index, *this;
     }
 
@@ -71,7 +65,7 @@ public:
         return operator--(), orig;
     }
 
-    storage_iterator & operator+=(const difference_type value) ENTT_NOEXCEPT {
+    storage_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
         index -= value;
         return *this;
     }
@@ -81,7 +75,7 @@ public:
         return (copy += value);
     }
 
-    storage_iterator & operator-=(const difference_type value) ENTT_NOEXCEPT {
+    storage_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
         return (*this += -value);
     }
 
@@ -135,16 +129,13 @@ private:
     difference_type index;
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Basic storage implementation.
  *
@@ -191,8 +182,8 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
     using comp_traits = component_traits<Type>;
     using underlying_type = basic_sparse_set<Entity, typename allocator_traits::template rebind_alloc<Entity>>;
 
-    [[nodiscard]] auto & element_at(const std::size_t pos) const {
-        return packed[pos/packed_page_v][fast_mod<packed_page_v>(pos)];
+    [[nodiscard]] auto &element_at(const std::size_t pos) const {
+        return packed[pos / packed_page_v][fast_mod<packed_page_v>(pos)];
     }
 
     auto assure_at_least(const std::size_t pos) {
@@ -208,7 +199,8 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
                 for(auto next = bucket.second(); next < sz; ++next) {
                     mem[next] = alloc_traits::allocate(bucket.first(), packed_page_v);
                 }
-            } ENTT_CATCH {
+            }
+            ENTT_CATCH {
                 for(auto next = bucket.second(); next < sz && mem[next]; ++next) {
                     alloc_traits::deallocate(bucket.first(), mem[next], packed_page_v);
                 }
@@ -271,7 +263,7 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
     }
 
     template<typename... Args>
-    void construct(alloc_pointer ptr, Args &&... args) {
+    void construct(alloc_pointer ptr, Args &&...args) {
         if constexpr(std::is_aggregate_v<value_type>) {
             alloc_traits::construct(bucket.first(), to_address(ptr), Type{std::forward<Args>(args)...});
         } else {
@@ -372,7 +364,8 @@ protected:
             ENTT_TRY {
                 base_type::try_emplace(entt, nullptr);
                 ENTT_ASSERT(pos == base_type::index(entt), "Misplaced component");
-            } ENTT_CATCH {
+            }
+            ENTT_CATCH {
                 std::destroy_at(std::addressof(element_at(pos)));
                 ENTT_THROW;
             }
@@ -407,8 +400,7 @@ public:
     basic_storage()
         : base_type{deletion_policy{comp_traits::in_place_delete::value}},
           bucket{allocator_type{}, size_type{}},
-          packed{}
-    {}
+          packed{} {}
 
     /**
      * @brief Constructs an empty storage with a given allocator.
@@ -417,8 +409,7 @@ public:
     explicit basic_storage(const allocator_type &allocator)
         : base_type{deletion_policy{comp_traits::in_place_delete::value}, allocator},
           bucket{allocator, size_type{}},
-          packed{}
-    {}
+          packed{} {}
 
     /**
      * @brief Move constructor.
@@ -427,8 +418,7 @@ public:
     basic_storage(basic_storage &&other) ENTT_NOEXCEPT
         : base_type{std::move(other)},
           bucket{std::move(other.bucket.first()), std::exchange(other.bucket.second(), size_type{})},
-          packed{std::exchange(other.packed, alloc_ptr_pointer{})}
-    {}
+          packed{std::exchange(other.packed, alloc_ptr_pointer{})} {}
 
     /**
      * @brief Allocator-extended move constructor.
@@ -438,8 +428,7 @@ public:
     basic_storage(basic_storage &&other, const allocator_type &allocator) ENTT_NOEXCEPT
         : base_type{std::move(other), allocator},
           bucket{allocator, std::exchange(other.bucket.second(), size_type{})},
-          packed{std::exchange(other.packed, alloc_ptr_pointer{})}
-    {
+          packed{std::exchange(other.packed, alloc_ptr_pointer{})} {
         ENTT_ASSERT(alloc_traits::is_always_equal::value || bucket.first() == other.bucket.first(), "Copying a storage is not allowed");
     }
 
@@ -453,7 +442,7 @@ public:
      * @param other The instance to move from.
      * @return This storage.
      */
-    basic_storage & operator=(basic_storage &&other) ENTT_NOEXCEPT {
+    basic_storage &operator=(basic_storage &&other) ENTT_NOEXCEPT {
         release_memory();
         base_type::operator=(std::move(other));
         propagate_on_container_move_assignment(bucket.first(), other.bucket.first());
@@ -619,12 +608,12 @@ public:
      * @param entt A valid identifier.
      * @return The object assigned to the entity.
      */
-    [[nodiscard]] const value_type & get(const entity_type entt) const ENTT_NOEXCEPT {
+    [[nodiscard]] const value_type &get(const entity_type entt) const ENTT_NOEXCEPT {
         return element_at(base_type::index(entt));
     }
 
     /*! @copydoc get */
-    [[nodiscard]] value_type & get(const entity_type entt) ENTT_NOEXCEPT {
+    [[nodiscard]] value_type &get(const entity_type entt) ENTT_NOEXCEPT {
         return const_cast<value_type &>(std::as_const(*this).get(entt));
     }
 
@@ -662,7 +651,7 @@ public:
      * @return A reference to the newly created object.
      */
     template<typename... Args>
-    value_type & emplace(const entity_type entt, Args &&... args) {
+    value_type &emplace(const entity_type entt, Args &&...args) {
         const auto pos = base_type::slot();
         alloc_pointer elem = assure_at_least(pos);
         construct(elem, std::forward<Args>(args)...);
@@ -670,7 +659,8 @@ public:
         ENTT_TRY {
             base_type::try_emplace(entt, nullptr);
             ENTT_ASSERT(pos == base_type::index(entt), "Misplaced component");
-        } ENTT_CATCH {
+        }
+        ENTT_CATCH {
             std::destroy_at(std::addressof(element_at(pos)));
             ENTT_THROW;
         }
@@ -686,7 +676,7 @@ public:
      * @return A reference to the updated instance.
      */
     template<typename... Func>
-    value_type & patch(const entity_type entt, Func &&... func) {
+    value_type &patch(const entity_type entt, Func &&...func) {
         const auto idx = base_type::index(entt);
         auto &elem = element_at(idx);
         (std::forward<Func>(func)(elem), ...);
@@ -733,12 +723,10 @@ private:
     alloc_ptr_pointer packed;
 };
 
-
 /*! @copydoc basic_storage */
 template<typename Entity, typename Type, typename Allocator>
 class basic_storage<Entity, Type, Allocator, std::enable_if_t<ignore_as_empty_v<Type>>>
-    : public basic_sparse_set<Entity, typename std::allocator_traits<Allocator>::template rebind_alloc<Entity>>
-{
+    : public basic_sparse_set<Entity, typename std::allocator_traits<Allocator>::template rebind_alloc<Entity>> {
     using allocator_traits = std::allocator_traits<Allocator>;
     using comp_traits = component_traits<Type>;
 
@@ -756,16 +744,14 @@ public:
 
     /*! @brief Default constructor. */
     basic_storage()
-        : base_type{deletion_policy{comp_traits::in_place_delete::value}}
-    {}
+        : base_type{deletion_policy{comp_traits::in_place_delete::value}} {}
 
     /**
      * @brief Constructs an empty container with a given allocator.
      * @param allocator The allocator to use.
      */
     explicit basic_storage(const allocator_type &allocator)
-        : base_type{deletion_policy{comp_traits::in_place_delete::value}, allocator}
-    {}
+        : base_type{deletion_policy{comp_traits::in_place_delete::value}, allocator} {}
 
     /**
      * @brief Move constructor.
@@ -778,7 +764,7 @@ public:
      * @param other The instance to move from.
      * @return This storage.
      */
-    basic_storage & operator=(basic_storage &&other) ENTT_NOEXCEPT = default;
+    basic_storage &operator=(basic_storage &&other) ENTT_NOEXCEPT = default;
 
     /**
      * @brief Returns the associated allocator.
@@ -828,7 +814,7 @@ public:
      * @param args Parameters to use to construct an object for the entity.
      */
     template<typename... Args>
-    void emplace(const entity_type entt, Args &&... args) {
+    void emplace(const entity_type entt, Args &&...args) {
         [[maybe_unused]] const value_type elem{std::forward<Args>(args)...};
         base_type::try_emplace(entt, nullptr);
     }
@@ -840,7 +826,7 @@ public:
     * @param func Valid function objects.
     */
     template<typename... Func>
-    void patch([[maybe_unused]] const entity_type entt, Func &&... func) {
+    void patch([[maybe_unused]] const entity_type entt, Func &&...func) {
         ENTT_ASSERT(base_type::contains(entt), "Storage does not contain entity");
         (std::forward<Func>(func)(), ...);
     }
@@ -866,7 +852,6 @@ public:
     }
 };
 
-
 /**
  * @brief Mixin type to use to wrap basic storage classes.
  * @tparam Type The type of the underlying storage.
@@ -891,7 +876,7 @@ struct storage_adapter_mixin: Type {
      * @return A reference to the newly created object.
      */
     template<typename... Args>
-    decltype(auto) emplace(basic_registry<entity_type> &, const entity_type entt, Args &&... args) {
+    decltype(auto) emplace(basic_registry<entity_type> &, const entity_type entt, Args &&...args) {
         return Type::emplace(entt, std::forward<Args>(args)...);
     }
 
@@ -903,7 +888,7 @@ struct storage_adapter_mixin: Type {
      * @return A reference to the patched instance.
      */
     template<typename... Func>
-    decltype(auto) patch(basic_registry<entity_type> &, const entity_type entt, Func &&... func) {
+    decltype(auto) patch(basic_registry<entity_type> &, const entity_type entt, Func &&...func) {
         return Type::patch(entt, std::forward<Func>(func)...);
     }
 
@@ -918,12 +903,11 @@ struct storage_adapter_mixin: Type {
      * entities.
      */
     template<typename It, typename... Args>
-    void insert(basic_registry<entity_type> &, It first, It last, Args &&... args) {
+    void insert(basic_registry<entity_type> &, It first, It last, Args &&...args) {
         Type::insert(std::move(first), std::move(last), std::forward<Args>(args)...);
     }
 };
 
-
 /**
  * @brief Mixin type to use to add signal support to storage types.
  * @tparam Type The type of the underlying storage.
@@ -1034,7 +1018,7 @@ public:
      * @return A reference to the newly created object.
      */
     template<typename... Args>
-    decltype(auto) emplace(basic_registry<entity_type> &owner, const entity_type entt, Args &&... args) {
+    decltype(auto) emplace(basic_registry<entity_type> &owner, const entity_type entt, Args &&...args) {
         Type::emplace(entt, std::forward<Args>(args)...);
         construction.publish(owner, entt);
         return this->get(entt);
@@ -1049,7 +1033,7 @@ public:
      * @return A reference to the patched instance.
      */
     template<typename... Func>
-    decltype(auto) patch(basic_registry<entity_type> &owner, const entity_type entt, Func &&... func) {
+    decltype(auto) patch(basic_registry<entity_type> &owner, const entity_type entt, Func &&...func) {
         Type::patch(entt, std::forward<Func>(func)...);
         update.publish(owner, entt);
         return this->get(entt);
@@ -1067,7 +1051,7 @@ public:
      * entities.
      */
     template<typename It, typename... Args>
-    void insert(basic_registry<entity_type> &owner, It first, It last, Args &&... args) {
+    void insert(basic_registry<entity_type> &owner, It first, It last, Args &&...args) {
         Type::insert(first, last, std::forward<Args>(args)...);
 
         if(!construction.empty()) {
@@ -1083,7 +1067,6 @@ private:
     sigh<void(basic_registry<entity_type> &, const entity_type)> update{};
 };
 
-
 /**
  * @brief Provides a common way to access certain properties of storage types.
  * @tparam Entity A valid entity type (see entt_traits for more details).
@@ -1095,8 +1078,6 @@ struct storage_traits {
     using storage_type = sigh_storage_mixin<basic_storage<Entity, Type>>;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 3 - 13
src/entt/entity/utility.hpp

@@ -1,13 +1,10 @@
 #ifndef ENTT_ENTITY_UTILITY_HPP
 #define ENTT_ENTITY_UTILITY_HPP
 
-
 #include "../core/type_traits.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Alias for exclusion lists.
  * @tparam Type List of types.
@@ -15,7 +12,6 @@ namespace entt {
 template<typename... Type>
 struct exclude_t: type_list<Type...> {};
 
-
 /**
  * @brief Variable template for exclusion lists.
  * @tparam Type List of types.
@@ -23,14 +19,12 @@ struct exclude_t: type_list<Type...> {};
 template<typename... Type>
 inline constexpr exclude_t<Type...> exclude{};
 
-
 /**
  * @brief Alias for lists of observed components.
  * @tparam Type List of types.
  */
 template<typename... Type>
-struct get_t: type_list<Type...>{};
-
+struct get_t: type_list<Type...> {};
 
 /**
  * @brief Variable template for lists of observed components.
@@ -39,14 +33,12 @@ struct get_t: type_list<Type...>{};
 template<typename... Type>
 inline constexpr get_t<Type...> get{};
 
-
 /**
  * @brief Alias for lists of owned components.
  * @tparam Type List of types.
  */
 template<typename... Type>
-struct owned_t: type_list<Type...>{};
-
+struct owned_t: type_list<Type...> {};
 
 /**
  * @brief Variable template for lists of owned components.
@@ -55,8 +47,6 @@ struct owned_t: type_list<Type...>{};
 template<typename... Type>
 inline constexpr owned_t<Type...> owned{};
 
-
-}
-
+} // namespace entt
 
 #endif

+ 44 - 75
src/entt/entity/view.hpp

@@ -1,13 +1,12 @@
 #ifndef ENTT_ENTITY_VIEW_HPP
 #define ENTT_ENTITY_VIEW_HPP
 
-
-#include <iterator>
+#include <algorithm>
 #include <array>
+#include <iterator>
 #include <tuple>
-#include <utility>
-#include <algorithm>
 #include <type_traits>
+#include <utility>
 #include "../config/config.h"
 #include "../core/type_traits.hpp"
 #include "component.hpp"
@@ -17,19 +16,15 @@
 #include "storage.hpp"
 #include "utility.hpp"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename Entity, typename Component>
 class iterable_storage final {
     using storage_type = constness_as_t<typename storage_traits<Entity, std::remove_const_t<Component>>::storage_type, Component>;
@@ -45,10 +40,9 @@ class iterable_storage final {
 
         template<typename... Discard>
         iterable_storage_iterator(It... from, Discard...) ENTT_NOEXCEPT
-            : it{from...}
-        {}
+            : it{from...} {}
 
-        iterable_storage_iterator & operator++() ENTT_NOEXCEPT {
+        iterable_storage_iterator &operator++() ENTT_NOEXCEPT {
             return (++std::get<It>(it), ...), *this;
         }
 
@@ -58,7 +52,7 @@ class iterable_storage final {
         }
 
         [[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
-            return { *std::get<It>(it)... };
+            return {*std::get<It>(it)...};
         }
 
         [[nodiscard]] bool operator==(const iterable_storage_iterator &other) const ENTT_NOEXCEPT {
@@ -77,17 +71,14 @@ public:
     using iterator = std::conditional_t<
         ignore_as_empty_v<std::remove_const_t<Component>>,
         iterable_storage_iterator<typename basic_common_type::iterator>,
-        iterable_storage_iterator<typename basic_common_type::iterator, decltype(std::declval<storage_type>().begin())>
-    >;
+        iterable_storage_iterator<typename basic_common_type::iterator, decltype(std::declval<storage_type>().begin())>>;
     using reverse_iterator = std::conditional_t<
         ignore_as_empty_v<std::remove_const_t<Component>>,
         iterable_storage_iterator<typename basic_common_type::reverse_iterator>,
-        iterable_storage_iterator<typename basic_common_type::reverse_iterator, decltype(std::declval<storage_type>().rbegin())>
-    >;
+        iterable_storage_iterator<typename basic_common_type::reverse_iterator, decltype(std::declval<storage_type>().rbegin())>>;
 
     iterable_storage(storage_type &ref)
-        : pool{&ref}
-    {}
+        : pool{&ref} {}
 
     [[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
         return iterator{pool->basic_common_type::begin(), pool->begin()};
@@ -106,18 +97,17 @@ public:
     }
 
 private:
-    storage_type * const pool;
+    storage_type *const pool;
 };
 
-
 template<typename Type, typename It, std::size_t Component, std::size_t Exclude>
 class view_iterator final {
     static constexpr auto is_multi_type_v = ((Component + Exclude) != 0u);
 
     [[nodiscard]] bool valid() const {
         return (is_multi_type_v || (*it != tombstone))
-            && std::apply([entt = *it](const auto *... curr) { return (curr->contains(entt) && ...); }, pools)
-            && std::apply([entt = *it](const auto *... curr) { return (!curr->contains(entt) && ...); }, filter);
+               && std::apply([entt = *it](const auto *...curr) { return (curr->contains(entt) && ...); }, pools)
+               && std::apply([entt = *it](const auto *...curr) { return (!curr->contains(entt) && ...); }, filter);
     }
 
 public:
@@ -133,22 +123,20 @@ public:
           last{},
           it{},
           pools{},
-          filter{}
-    {}
+          filter{} {}
 
     view_iterator(It from, It to, It curr, std::array<const Type *, Component> all_of, std::array<const Type *, Exclude> none_of) ENTT_NOEXCEPT
         : first{from},
           last{to},
           it{curr},
           pools{all_of},
-          filter{none_of}
-    {
+          filter{none_of} {
         if(it != last && !valid()) {
             ++(*this);
         }
     }
 
-    view_iterator & operator++() ENTT_NOEXCEPT {
+    view_iterator &operator++() ENTT_NOEXCEPT {
         while(++it != last && !valid()) { continue; }
         return *this;
     }
@@ -158,7 +146,7 @@ public:
         return ++(*this), orig;
     }
 
-    view_iterator & operator--() ENTT_NOEXCEPT {
+    view_iterator &operator--() ENTT_NOEXCEPT {
         while(--it != first && !valid()) { continue; }
         return *this;
     }
@@ -192,16 +180,13 @@ private:
     std::array<const Type *, Exclude> filter;
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief View implementation.
  *
@@ -211,7 +196,6 @@ private:
 template<typename, typename, typename, typename>
 class basic_view;
 
-
 /**
  * @brief Multi component view.
  *
@@ -264,10 +248,9 @@ class basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>> {
 
             iterable_iterator(It from, const basic_view *parent) ENTT_NOEXCEPT
                 : it{from},
-                  view{parent}
-            {}
+                  view{parent} {}
 
-            iterable_iterator & operator++() ENTT_NOEXCEPT {
+            iterable_iterator &operator++() ENTT_NOEXCEPT {
                 return ++it, *this;
             }
 
@@ -298,31 +281,30 @@ class basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>> {
         using reverse_iterator = iterable_iterator<internal::view_iterator<basic_common_type, typename basic_common_type::reverse_iterator, sizeof...(Component) - 1u, sizeof...(Exclude)>>;
 
         iterable(const basic_view &parent)
-            : view{parent}
-        {}
+            : view{parent} {}
 
         [[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
-            return { view.begin(), &view };
+            return {view.begin(), &view};
         }
 
         [[nodiscard]] iterator end() const ENTT_NOEXCEPT {
-            return { view.end(), &view };
+            return {view.end(), &view};
         }
 
         [[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
-            return { view.rbegin(), &view };
+            return {view.rbegin(), &view};
         }
 
         [[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
-            return { view.rend(), &view };
+            return {view.rend(), &view};
         }
 
     private:
         const basic_view view;
     };
 
-    [[nodiscard]] const auto * candidate() const ENTT_NOEXCEPT {
-        return (std::min)({ static_cast<const basic_common_type *>(std::get<storage_type<Component> *>(pools))... }, [](const auto *lhs, const auto *rhs) {
+    [[nodiscard]] const auto *candidate() const ENTT_NOEXCEPT {
+        return (std::min)({static_cast<const basic_common_type *>(std::get<storage_type<Component> *>(pools))...}, [](const auto *lhs, const auto *rhs) {
             return lhs->size() < rhs->size();
         });
     }
@@ -366,19 +348,17 @@ public:
     basic_view() ENTT_NOEXCEPT
         : pools{},
           filter{},
-          view{}
-    {}
+          view{} {}
 
     /**
      * @brief Constructs a multi-type view from a set of storage classes.
      * @param component The storage for the types to iterate.
      * @param epool The storage for the types used to filter the view.
      */
-    basic_view(storage_type<Component> &... component, const storage_type<Exclude> &... epool) ENTT_NOEXCEPT
+    basic_view(storage_type<Component> &...component, const storage_type<Exclude> &...epool) ENTT_NOEXCEPT
         : pools{&component...},
           filter{&epool...},
-          view{candidate()}
-    {}
+          view{candidate()} {}
 
     /**
      * @brief Creates a new view driven by a given type in its iterations.
@@ -507,7 +487,7 @@ public:
      */
     [[nodiscard]] bool contains(const entity_type entt) const {
         return (std::get<storage_type<Component> *>(pools)->contains(entt) && ...)
-            && std::apply([entt](const auto *... curr) { return (!curr->contains(entt) && ...); }, filter);
+               && std::apply([entt](const auto *...curr) { return (!curr->contains(entt) && ...); }, filter);
     }
 
     /**
@@ -583,9 +563,8 @@ public:
     void each(Func func) const {
         for(const auto curr: internal::iterable_storage<Entity, Comp>{*std::get<storage_type<Comp> *>(pools)}) {
             if((is_multi_type_v || (std::get<0>(curr) != tombstone))
-                && ((std::is_same_v<Comp, Component> || std::get<storage_type<Component> *>(pools)->contains(std::get<0>(curr))) && ...)
-                && std::apply([entt = std::get<0>(curr)](const auto *... cpool) { return (!cpool->contains(entt) && ...); }, filter))
-            {
+               && ((std::is_same_v<Comp, Component> || std::get<storage_type<Component> *>(pools)->contains(std::get<0>(curr))) && ...)
+               && std::apply([entt = std::get<0>(curr)](const auto *...cpool) { return (!cpool->contains(entt) && ...); }, filter)) {
                 if constexpr(is_applicable_v<Func, decltype(std::tuple_cat(std::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
                     std::apply(func, std::tuple_cat(std::make_tuple(std::get<0>(curr)), dispatch_get<Comp, Component>(curr)...));
                 } else {
@@ -642,21 +621,18 @@ public:
     [[nodiscard]] auto operator|(const basic_view<Entity, get_t<Get...>, exclude_t<Excl...>> &other) const ENTT_NOEXCEPT {
         using view_type = basic_view<Entity, get_t<Component..., Get...>, exclude_t<Exclude..., Excl...>>;
         return std::make_from_tuple<view_type>(std::tuple_cat(
-            std::apply([](auto *... curr) { return std::forward_as_tuple(*curr...); }, pools),
-            std::apply([](auto *... curr) { return std::forward_as_tuple(*curr...); }, other.pools),
-            std::apply([](const auto *... curr) { return std::forward_as_tuple(static_cast<const storage_type<Exclude> &>(*curr)...); }, filter),
-            std::apply([](const auto *... curr) { return std::forward_as_tuple(static_cast<const storage_type<Excl> &>(*curr)...); }, other.filter)
-        ));
+            std::apply([](auto *...curr) { return std::forward_as_tuple(*curr...); }, pools),
+            std::apply([](auto *...curr) { return std::forward_as_tuple(*curr...); }, other.pools),
+            std::apply([](const auto *...curr) { return std::forward_as_tuple(static_cast<const storage_type<Exclude> &>(*curr)...); }, filter),
+            std::apply([](const auto *...curr) { return std::forward_as_tuple(static_cast<const storage_type<Excl> &>(*curr)...); }, other.filter)));
     }
 
-
 private:
     std::tuple<storage_type<Component> *...> pools;
     std::array<const basic_common_type *, sizeof...(Exclude)> filter;
     const basic_common_type *view;
 };
 
-
 /**
  * @brief Single component view specialization.
  *
@@ -689,8 +665,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<>, 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;
 
@@ -713,8 +688,7 @@ public:
     /*! @brief Default constructor to use to create empty, invalid views. */
     basic_view() ENTT_NOEXCEPT
         : pools{},
-          filter{}
-    {}
+          filter{} {}
 
     /**
      * @brief Constructs a single-type view from a storage class.
@@ -722,8 +696,7 @@ public:
      */
     basic_view(storage_type &ref) ENTT_NOEXCEPT
         : pools{&ref},
-          filter{}
-    {}
+          filter{} {}
 
     /**
      * @brief Returns the number of entities that have the given component.
@@ -981,10 +954,9 @@ public:
     [[nodiscard]] auto operator|(const basic_view<Entity, get_t<Get...>, exclude_t<Excl...>> &other) const ENTT_NOEXCEPT {
         using view_type = basic_view<Entity, get_t<Component, Get...>, exclude_t<Excl...>>;
         return std::make_from_tuple<view_type>(std::tuple_cat(
-            std::apply([](auto *... curr) { return std::forward_as_tuple(*curr...); }, pools),
-            std::apply([](auto *... curr) { return std::forward_as_tuple(*curr...); }, other.pools),
-            std::apply([](const auto *... curr) { return std::forward_as_tuple(static_cast<const typename view_type::template storage_type<Excl> &>(*curr)...); }, other.filter)
-        ));
+            std::apply([](auto *...curr) { return std::forward_as_tuple(*curr...); }, pools),
+            std::apply([](auto *...curr) { return std::forward_as_tuple(*curr...); }, other.pools),
+            std::apply([](const auto *...curr) { return std::forward_as_tuple(static_cast<const typename view_type::template storage_type<Excl> &>(*curr)...); }, other.filter)));
     }
 
 private:
@@ -992,17 +964,14 @@ private:
     std::tuple<> filter;
 };
 
-
 /**
  * @brief Deduction guide.
  * @tparam Storage Type of storage classes used to create the view.
  * @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<>>;
 
+} // namespace entt
 
 #endif

+ 3 - 8
src/entt/locator/locator.hpp

@@ -1,15 +1,12 @@
 #ifndef ENTT_LOCATOR_LOCATOR_HPP
 #define ENTT_LOCATOR_LOCATOR_HPP
 
-
 #include <memory>
 #include <utility>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /**
  * @brief Service locator, nothing more.
  *
@@ -67,7 +64,7 @@ struct service_locator {
      *
      * @return A reference to the service implementation currently set, if any.
      */
-    [[nodiscard]] static Service & ref() ENTT_NOEXCEPT {
+    [[nodiscard]] static Service &ref() ENTT_NOEXCEPT {
         return *service;
     }
 
@@ -78,7 +75,7 @@ struct service_locator {
      * @param args Parameters to use to construct the service.
      */
     template<typename Impl = Service, typename... Args>
-    static void set(Args &&... args) {
+    static void set(Args &&...args) {
         service = std::make_shared<Impl>(std::forward<Args>(args)...);
     }
 
@@ -104,8 +101,6 @@ private:
     inline static std::shared_ptr<Service> service = nullptr;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 6
src/entt/meta/adl_pointer.hpp

@@ -1,10 +1,8 @@
 #ifndef ENTT_META_ADL_POINTER_HPP
 #define ENTT_META_ADL_POINTER_HPP
 
-
 namespace entt {
 
-
 /**
  * @brief ADL based lookup function for dereferencing meta pointer-like types.
  * @tparam Type Element type.
@@ -16,7 +14,6 @@ decltype(auto) dereference_meta_pointer_like(const Type &value) {
     return *value;
 }
 
-
 /**
  * @brief Fake ADL based lookup function for meta pointer-like types.
  * @tparam Type Element type.
@@ -33,8 +30,6 @@ struct adl_meta_pointer_like {
     }
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 21 - 45
src/entt/meta/container.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_META_CONTAINER_HPP
 #define ENTT_META_CONTAINER_HPP
 
-
 #include <array>
 #include <map>
 #include <set>
@@ -12,33 +11,27 @@
 #include "meta.hpp"
 #include "type_traits.hpp"
 
-
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename, typename = void>
 struct is_dynamic_sequence_container: std::false_type {};
 
 template<typename Type>
 struct is_dynamic_sequence_container<Type, std::void_t<decltype(&Type::reserve)>>: std::true_type {};
 
-
 template<typename, typename = void>
 struct is_key_only_meta_associative_container: std::true_type {};
 
 template<typename Type>
 struct is_key_only_meta_associative_container<Type, std::void_t<typename Type::mapped_type>>: std::false_type {};
 
-
 template<typename Type>
 struct basic_meta_sequence_container_traits {
     using iterator = meta_sequence_container::iterator;
@@ -50,7 +43,7 @@ struct basic_meta_sequence_container_traits {
 
     [[nodiscard]] static bool resize([[maybe_unused]] any &container, [[maybe_unused]] size_type sz) {
         if constexpr(is_dynamic_sequence_container<Type>::value) {
-            if(auto * const cont = any_cast<Type>(&container); cont) {
+            if(auto *const cont = any_cast<Type>(&container); cont) {
                 cont->resize(sz);
                 return true;
             }
@@ -61,7 +54,7 @@ struct basic_meta_sequence_container_traits {
 
     [[nodiscard]] static bool clear([[maybe_unused]] any &container) {
         if constexpr(is_dynamic_sequence_container<Type>::value) {
-            if(auto * const cont = any_cast<Type>(&container); cont) {
+            if(auto *const cont = any_cast<Type>(&container); cont) {
                 cont->clear();
                 return true;
             }
@@ -71,7 +64,7 @@ struct basic_meta_sequence_container_traits {
     }
 
     [[nodiscard]] static iterator begin(any &container) {
-        if(auto * const cont = any_cast<Type>(&container); cont) {
+        if(auto *const cont = any_cast<Type>(&container); cont) {
             return iterator{std::begin(*cont)};
         }
 
@@ -79,7 +72,7 @@ struct basic_meta_sequence_container_traits {
     }
 
     [[nodiscard]] static iterator end(any &container) {
-        if(auto * const cont = any_cast<Type>(&container); cont) {
+        if(auto *const cont = any_cast<Type>(&container); cont) {
             return iterator{std::end(*cont)};
         }
 
@@ -88,7 +81,7 @@ struct basic_meta_sequence_container_traits {
 
     [[nodiscard]] static iterator insert([[maybe_unused]] any &container, [[maybe_unused]] iterator it, [[maybe_unused]] meta_any &value) {
         if constexpr(is_dynamic_sequence_container<Type>::value) {
-            if(auto * const cont = any_cast<Type>(&container); cont) {
+            if(auto *const cont = any_cast<Type>(&container); cont) {
                 // this abomination is necessary because only on macos value_type and const_reference are different types for std::vector<bool>
                 if(value.allow_cast<typename Type::const_reference>() || value.allow_cast<typename Type::value_type>()) {
                     const auto *element = value.try_cast<std::remove_reference_t<typename Type::const_reference>>();
@@ -102,7 +95,7 @@ struct basic_meta_sequence_container_traits {
 
     [[nodiscard]] static iterator erase([[maybe_unused]] any &container, [[maybe_unused]] iterator it) {
         if constexpr(is_dynamic_sequence_container<Type>::value) {
-            if(auto * const cont = any_cast<Type>(&container); cont) {
+            if(auto *const cont = any_cast<Type>(&container); cont) {
                 return iterator{cont->erase(any_cast<const typename Type::iterator &>(it.base()))};
             }
         }
@@ -111,7 +104,7 @@ struct basic_meta_sequence_container_traits {
     }
 
     [[nodiscard]] static meta_any get(any &container, size_type pos) {
-        if(auto * const cont = any_cast<Type>(&container); cont) {
+        if(auto *const cont = any_cast<Type>(&container); cont) {
             return meta_any{std::in_place_type<typename Type::reference>, (*cont)[pos]};
         }
 
@@ -119,7 +112,6 @@ struct basic_meta_sequence_container_traits {
     }
 };
 
-
 template<typename Type>
 struct basic_meta_associative_container_traits {
     using iterator = meta_associative_container::iterator;
@@ -132,7 +124,7 @@ struct basic_meta_associative_container_traits {
     }
 
     [[nodiscard]] static bool clear(any &container) {
-        if(auto * const cont = any_cast<Type>(&container); cont) {
+        if(auto *const cont = any_cast<Type>(&container); cont) {
             cont->clear();
             return true;
         }
@@ -141,7 +133,7 @@ struct basic_meta_associative_container_traits {
     }
 
     [[nodiscard]] static iterator begin(any &container) {
-        if(auto * const cont = any_cast<Type>(&container); cont) {
+        if(auto *const cont = any_cast<Type>(&container); cont) {
             return iterator{std::integral_constant<bool, key_only>{}, cont->begin()};
         }
 
@@ -149,7 +141,7 @@ struct basic_meta_associative_container_traits {
     }
 
     [[nodiscard]] static iterator end(any &container) {
-        if(auto * const cont = any_cast<Type>(&container); cont) {
+        if(auto *const cont = any_cast<Type>(&container); cont) {
             return iterator{std::integral_constant<bool, key_only>{}, cont->end()};
         }
 
@@ -157,7 +149,7 @@ struct basic_meta_associative_container_traits {
     }
 
     [[nodiscard]] static bool insert(any &container, meta_any &key, [[maybe_unused]] meta_any &value) {
-        if(auto * const cont = any_cast<Type>(&container); cont && key.allow_cast<const typename Type::key_type &>()) {
+        if(auto *const cont = any_cast<Type>(&container); cont && key.allow_cast<const typename Type::key_type &>()) {
             if constexpr(is_key_only_meta_associative_container<Type>::value) {
                 return cont->insert(key.cast<const typename Type::key_type &>()).second;
             } else {
@@ -171,7 +163,7 @@ struct basic_meta_associative_container_traits {
     }
 
     [[nodiscard]] static bool erase(any &container, meta_any &key) {
-        if(auto * const cont = any_cast<Type>(&container); cont && key.allow_cast<const typename Type::key_type &>()) {
+        if(auto *const cont = any_cast<Type>(&container); cont && key.allow_cast<const typename Type::key_type &>()) {
             return (cont->erase(key.cast<const typename Type::key_type &>()) != cont->size());
         }
 
@@ -180,7 +172,7 @@ struct basic_meta_associative_container_traits {
 
     [[nodiscard]] static iterator find(any &container, meta_any &key) {
         if(key.allow_cast<const typename Type::key_type &>()) {
-            if(auto * const cont = any_cast<Type>(&container); cont) {
+            if(auto *const cont = any_cast<Type>(&container); cont) {
                 return iterator{std::integral_constant<bool, key_only>{}, cont->find(key.cast<const typename Type::key_type &>())};
             }
 
@@ -191,16 +183,13 @@ struct basic_meta_associative_container_traits {
     }
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Meta sequence container traits for `std::vector`s of any type.
  * @tparam Type The type of elements.
@@ -208,9 +197,7 @@ struct basic_meta_associative_container_traits {
  */
 template<typename Type, typename... Args>
 struct meta_sequence_container_traits<std::vector<Type, Args...>>
-    : internal::basic_meta_sequence_container_traits<std::vector<Type, Args...>>
-{};
-
+    : internal::basic_meta_sequence_container_traits<std::vector<Type, Args...>> {};
 
 /**
  * @brief Meta sequence container traits for `std::array`s of any type.
@@ -219,9 +206,7 @@ struct meta_sequence_container_traits<std::vector<Type, Args...>>
  */
 template<typename Type, auto N>
 struct meta_sequence_container_traits<std::array<Type, N>>
-    : internal::basic_meta_sequence_container_traits<std::array<Type, N>>
-{};
-
+    : internal::basic_meta_sequence_container_traits<std::array<Type, N>> {};
 
 /**
  * @brief Meta associative container traits for `std::map`s of any type.
@@ -231,9 +216,7 @@ struct meta_sequence_container_traits<std::array<Type, N>>
  */
 template<typename Key, typename Value, typename... Args>
 struct meta_associative_container_traits<std::map<Key, Value, Args...>>
-    : internal::basic_meta_associative_container_traits<std::map<Key, Value, Args...>>
-{};
-
+    : internal::basic_meta_associative_container_traits<std::map<Key, Value, Args...>> {};
 
 /**
  * @brief Meta associative container traits for `std::unordered_map`s of any
@@ -244,9 +227,7 @@ struct meta_associative_container_traits<std::map<Key, Value, Args...>>
  */
 template<typename Key, typename Value, typename... Args>
 struct meta_associative_container_traits<std::unordered_map<Key, Value, Args...>>
-    : internal::basic_meta_associative_container_traits<std::unordered_map<Key, Value, Args...>>
-{};
-
+    : internal::basic_meta_associative_container_traits<std::unordered_map<Key, Value, Args...>> {};
 
 /**
  * @brief Meta associative container traits for `std::set`s of any type.
@@ -255,9 +236,7 @@ struct meta_associative_container_traits<std::unordered_map<Key, Value, Args...>
  */
 template<typename Key, typename... Args>
 struct meta_associative_container_traits<std::set<Key, Args...>>
-    : internal::basic_meta_associative_container_traits<std::set<Key, Args...>>
-{};
-
+    : internal::basic_meta_associative_container_traits<std::set<Key, Args...>> {};
 
 /**
  * @brief Meta associative container traits for `std::unordered_set`s of any
@@ -267,11 +246,8 @@ struct meta_associative_container_traits<std::set<Key, Args...>>
  */
 template<typename Key, typename... Args>
 struct meta_associative_container_traits<std::unordered_set<Key, Args...>>
-    : internal::basic_meta_associative_container_traits<std::unordered_set<Key, Args...>>
-{};
-
-
-}
+    : internal::basic_meta_associative_container_traits<std::unordered_set<Key, Args...>> {};
 
+} // namespace entt
 
 #endif

+ 5 - 16
src/entt/meta/ctx.hpp

@@ -1,52 +1,43 @@
 #ifndef ENTT_META_CTX_HPP
 #define ENTT_META_CTX_HPP
 
-
-#include "../core/attribute.h"
 #include "../config/config.h"
-
+#include "../core/attribute.h"
 
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 struct meta_type_node;
 
-
 struct ENTT_API meta_context {
     // we could use the lines below but VS2017 returns with an ICE if combined with ENTT_API despite the code being valid C++
     //     inline static meta_type_node *local = nullptr;
     //     inline static meta_type_node **global = &local;
 
-    [[nodiscard]] static meta_type_node * & local() ENTT_NOEXCEPT {
+    [[nodiscard]] static meta_type_node *&local() ENTT_NOEXCEPT {
         static meta_type_node *chain = nullptr;
         return chain;
     }
 
-    [[nodiscard]] static meta_type_node ** & global() ENTT_NOEXCEPT {
+    [[nodiscard]] static meta_type_node **&global() ENTT_NOEXCEPT {
         static meta_type_node **chain = &local();
         return chain;
     }
 };
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /*! @brief Opaque container for a meta context. */
 struct meta_ctx {
     /**
@@ -61,8 +52,6 @@ private:
     internal::meta_type_node **ctx{&internal::meta_context::local()};
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 15 - 27
src/entt/meta/factory.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_META_FACTORY_HPP
 #define ENTT_META_FACTORY_HPP
 
-
 #include <algorithm>
 #include <cstddef>
 #include <tuple>
@@ -17,10 +16,8 @@
 #include "range.hpp"
 #include "utility.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Meta factory to be used for reflection purposes.
  *
@@ -32,7 +29,6 @@ namespace entt {
 template<typename...>
 class meta_factory;
 
-
 /**
  * @brief Extended meta factory to be used for reflection purposes.
  * @tparam Type Reflected type for which the factory was created.
@@ -49,21 +45,21 @@ class meta_factory<Type, Spec...>: public meta_factory<Type> {
     }
 
     template<std::size_t Step = 0, typename... Property, typename... Other>
-    void unroll(choice_t<2>, std::tuple<Property...> property, Other &&... other) {
-        std::apply([this](auto &&... curr) { (unroll<Step>(choice<2>, std::forward<Property>(curr)), ...); }, property);
+    void unroll(choice_t<2>, std::tuple<Property...> property, Other &&...other) {
+        std::apply([this](auto &&...curr) { (unroll<Step>(choice<2>, std::forward<Property>(curr)), ...); }, property);
         unroll<Step + sizeof...(Property)>(choice<2>, std::forward<Other>(other)...);
     }
 
     template<std::size_t Step = 0, typename... Property, typename... Other>
-    void unroll(choice_t<1>, std::pair<Property...> property, Other &&... other) {
+    void unroll(choice_t<1>, std::pair<Property...> property, Other &&...other) {
         assign<Step>(std::move(property.first), std::move(property.second));
-        unroll<Step+1>(choice<2>, std::forward<Other>(other)...);
+        unroll<Step + 1>(choice<2>, std::forward<Other>(other)...);
     }
 
     template<std::size_t Step = 0, typename Property, typename... Other>
-    void unroll(choice_t<0>, Property &&property, Other &&... other) {
+    void unroll(choice_t<0>, Property &&property, Other &&...other) {
         assign<Step>(std::forward<Property>(property));
-        unroll<Step+1>(choice<2>, std::forward<Other>(other)...);
+        unroll<Step + 1>(choice<2>, std::forward<Other>(other)...);
     }
 
     template<std::size_t>
@@ -92,8 +88,7 @@ public:
      * @param target The underlying node to which to assign the properties.
      */
     meta_factory(internal::meta_prop_node **target) ENTT_NOEXCEPT
-        : ref{target}
-    {}
+        : ref{target} {}
 
     /**
      * @brief Assigns a property to the last meta object created.
@@ -107,7 +102,7 @@ public:
      * @return A meta factory for the parent type.
      */
     template<typename PropertyOrKey, typename... Value>
-    meta_factory<Type> prop(PropertyOrKey &&property_or_key, Value &&... value) && {
+    meta_factory<Type> prop(PropertyOrKey &&property_or_key, Value &&...value) && {
         if constexpr(sizeof...(Value) == 0) {
             unroll(choice<3>, std::forward<PropertyOrKey>(property_or_key));
         } else {
@@ -126,7 +121,7 @@ public:
      * @param property Properties to assign to the last meta object created.
      * @return A meta factory for the parent type.
      */
-    template <typename... Property>
+    template<typename... Property>
     meta_factory<Type> props(Property... property) && {
         unroll(choice<3>, std::forward<Property>(property)...);
         return {};
@@ -136,7 +131,6 @@ private:
     internal::meta_prop_node **ref;
 };
 
-
 /**
  * @brief Basic meta factory to be used for reflection purposes.
  * @tparam Type Reflected type for which the factory was created.
@@ -210,8 +204,7 @@ class meta_factory<Type> {
 public:
     /*! @brief Default constructor. */
     meta_factory()
-        : owner{internal::meta_node<Type>::resolve()}
-    {}
+        : owner{internal::meta_node<Type>::resolve()} {}
 
     /**
      * @brief Makes a meta type _searchable_.
@@ -363,7 +356,7 @@ public:
      */
     template<typename... Args>
     auto ctor() ENTT_NOEXCEPT {
-        using descriptor = meta_function_helper_t<Type, Type(*)(Args...)>;
+        using descriptor = meta_function_helper_t<Type, Type (*)(Args...)>;
 
         static internal::meta_ctor_node node{
             nullptr,
@@ -560,7 +553,6 @@ private:
     internal::meta_type_node *owner;
 };
 
-
 /**
  * @brief Utility function to use for reflection.
  *
@@ -574,12 +566,11 @@ private:
  */
 template<typename Type>
 [[nodiscard]] auto meta() ENTT_NOEXCEPT {
-    auto * const node = internal::meta_node<Type>::resolve();
+    auto *const node = internal::meta_node<Type>::resolve();
     // extended meta factory to allow assigning properties to opaque meta types
     return meta_factory<Type, Type>{&node->prop};
 }
 
-
 /**
  * @brief Resets a type and all its parts.
  *
@@ -596,12 +587,12 @@ inline void meta_reset(const id_type id) ENTT_NOEXCEPT {
         for(; *curr; *curr = std::exchange((*curr)->next, nullptr)) {
             if constexpr(sizeof...(member) != 0u) {
                 static_assert(sizeof...(member) == 1u, "Assert in defense of the future me");
-                for(auto **sub = (&((*curr)->*member), ...); *sub; *sub = std::exchange((*sub)->next, nullptr));
+                for(auto **sub = (&((*curr)->*member), ...); *sub; *sub = std::exchange((*sub)->next, nullptr)) { continue; }
             }
         }
     };
 
-    for(auto** it = internal::meta_context::global(); *it; it = &(*it)->next) {
+    for(auto **it = internal::meta_context::global(); *it; it = &(*it)->next) {
         if(auto *node = *it; node->id == id) {
             clear_chain(&node->prop);
             clear_chain(&node->base);
@@ -631,7 +622,6 @@ void meta_reset() ENTT_NOEXCEPT {
     meta_reset(internal::meta_node<Type>::resolve()->id);
 }
 
-
 /**
  * @brief Resets all searchable types.
  *
@@ -643,8 +633,6 @@ inline void meta_reset() ENTT_NOEXCEPT {
     }
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 12
src/entt/meta/fwd.hpp

@@ -1,35 +1,24 @@
 #ifndef ENTT_META_FWD_HPP
 #define ENTT_META_FWD_HPP
 
-
 namespace entt {
 
-
 class meta_sequence_container;
 
-
 class meta_associative_container;
 
-
 class meta_any;
 
-
 struct meta_handle;
 
-
 struct meta_prop;
 
-
 struct meta_data;
 
-
 struct meta_func;
 
-
 class meta_type;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 74 - 138
src/entt/meta/meta.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_META_META_HPP
 #define ENTT_META_META_HPP
 
-
 #include <cstddef>
 #include <iterator>
 #include <memory>
@@ -10,23 +9,20 @@
 #include "../config/config.h"
 #include "../core/any.hpp"
 #include "../core/fwd.hpp"
-#include "../core/utility.hpp"
 #include "../core/type_info.hpp"
 #include "../core/type_traits.hpp"
+#include "../core/utility.hpp"
 #include "adl_pointer.hpp"
 #include "ctx.hpp"
 #include "node.hpp"
 #include "range.hpp"
 #include "type_traits.hpp"
 
-
 namespace entt {
 
-
 class meta_any;
 class meta_type;
 
-
 /*! @brief Proxy object for sequence containers. */
 class meta_sequence_container {
     class meta_iterator;
@@ -56,8 +52,7 @@ public:
           insert_fn{&meta_sequence_container_traits<Type>::insert},
           erase_fn{&meta_sequence_container_traits<Type>::erase},
           get_fn{&meta_sequence_container_traits<Type>::get},
-          storage{std::move(instance)}
-    {}
+          storage{std::move(instance)} {}
 
     [[nodiscard]] inline meta_type value_type() const ENTT_NOEXCEPT;
     [[nodiscard]] inline size_type size() const ENTT_NOEXCEPT;
@@ -72,18 +67,17 @@ public:
 
 private:
     internal::meta_type_node *value_type_node = nullptr;
-    size_type(* size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
-    bool(* resize_fn)(any &, size_type) = nullptr;
-    bool(* clear_fn)(any &) = nullptr;
-    iterator(* begin_fn)(any &) = nullptr;
-    iterator(* end_fn)(any &) = nullptr;
-    iterator(* insert_fn)(any &, iterator, meta_any &) = nullptr;
-    iterator(* erase_fn)(any &, iterator) = nullptr;
-    meta_any(* get_fn)(any &, size_type) = nullptr;
+    size_type (*size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
+    bool (*resize_fn)(any &, size_type) = nullptr;
+    bool (*clear_fn)(any &) = nullptr;
+    iterator (*begin_fn)(any &) = nullptr;
+    iterator (*end_fn)(any &) = nullptr;
+    iterator (*insert_fn)(any &, iterator, meta_any &) = nullptr;
+    iterator (*erase_fn)(any &, iterator) = nullptr;
+    meta_any (*get_fn)(any &, size_type) = nullptr;
     any storage{};
 };
 
-
 /*! @brief Proxy object for associative containers. */
 class meta_associative_container {
     class meta_iterator;
@@ -115,8 +109,7 @@ public:
           insert_fn{&meta_associative_container_traits<Type>::insert},
           erase_fn{&meta_associative_container_traits<Type>::erase},
           find_fn{&meta_associative_container_traits<Type>::find},
-          storage{std::move(instance)}
-    {
+          storage{std::move(instance)} {
         if constexpr(!meta_associative_container_traits<Type>::key_only) {
             mapped_type_node = internal::meta_node<std::remove_const_t<std::remove_reference_t<typename Type::mapped_type>>>::resolve();
         }
@@ -140,21 +133,22 @@ private:
     internal::meta_type_node *key_type_node = nullptr;
     internal::meta_type_node *mapped_type_node = nullptr;
     internal::meta_type_node *value_type_node = nullptr;
-    size_type(* size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
-    bool(* clear_fn)(any &) = nullptr;
-    iterator(* begin_fn)(any &) = nullptr;
-    iterator(* end_fn)(any &) = nullptr;
-    bool(* insert_fn)(any &, meta_any &, meta_any &) = nullptr;
-    bool(* erase_fn)(any &, meta_any &) = nullptr;
-    iterator(* find_fn)(any &, meta_any &) = nullptr;
+    size_type (*size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
+    bool (*clear_fn)(any &) = nullptr;
+    iterator (*begin_fn)(any &) = nullptr;
+    iterator (*end_fn)(any &) = nullptr;
+    bool (*insert_fn)(any &, meta_any &, meta_any &) = nullptr;
+    bool (*erase_fn)(any &, meta_any &) = nullptr;
+    iterator (*find_fn)(any &, meta_any &) = nullptr;
     any storage{};
 };
 
-
 /*! @brief Opaque wrapper for values of any type. */
 class meta_any {
-    enum class operation: std::uint8_t {
-        DEREF, SEQ, ASSOC
+    enum class operation : std::uint8_t {
+        DEREF,
+        SEQ,
+        ASSOC
     };
 
     using vtable_type = void(const operation, const any &, void *);
@@ -177,12 +171,12 @@ class meta_any {
                 break;
             case operation::SEQ:
                 if constexpr(is_complete_v<meta_sequence_container_traits<Type>>) {
-                    *static_cast<meta_sequence_container *>(to) = { std::in_place_type<Type>, std::move(const_cast<any &>(from)) };
+                    *static_cast<meta_sequence_container *>(to) = {std::in_place_type<Type>, std::move(const_cast<any &>(from))};
                 }
                 break;
             case operation::ASSOC:
                 if constexpr(is_complete_v<meta_associative_container_traits<Type>>) {
-                    *static_cast<meta_associative_container *>(to) = { std::in_place_type<Type>, std::move(const_cast<any &>(from)) };
+                    *static_cast<meta_associative_container *>(to) = {std::in_place_type<Type>, std::move(const_cast<any &>(from))};
                 }
                 break;
             }
@@ -198,16 +192,14 @@ class meta_any {
     meta_any(const meta_any &other, any ref) ENTT_NOEXCEPT
         : storage{std::move(ref)},
           node{storage ? other.node : nullptr},
-          vtable{storage ? other.vtable : &basic_vtable<void>}
-    {}
+          vtable{storage ? other.vtable : &basic_vtable<void>} {}
 
 public:
     /*! @brief Default constructor. */
     meta_any() ENTT_NOEXCEPT
         : storage{},
           node{},
-          vtable{&basic_vtable<void>}
-    {}
+          vtable{&basic_vtable<void>} {}
 
     /**
      * @brief Constructs a wrapper by directly initializing the new object.
@@ -216,11 +208,10 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    explicit meta_any(std::in_place_type_t<Type>, Args &&... args)
+    explicit meta_any(std::in_place_type_t<Type>, Args &&...args)
         : storage{std::in_place_type<Type>, std::forward<Args>(args)...},
           node{internal::meta_node<std::remove_const_t<std::remove_reference_t<Type>>>::resolve()},
-          vtable{&basic_vtable<std::remove_const_t<std::remove_reference_t<Type>>>}
-    {}
+          vtable{&basic_vtable<std::remove_const_t<std::remove_reference_t<Type>>>} {}
 
     /**
      * @brief Constructs a wrapper from a given value.
@@ -229,8 +220,7 @@ public:
      */
     template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Type>, meta_any>>>
     meta_any(Type &&value)
-        : meta_any{std::in_place_type<std::remove_const_t<std::remove_reference_t<Type>>>, std::forward<Type>(value)}
-    {}
+        : meta_any{std::in_place_type<std::remove_const_t<std::remove_reference_t<Type>>>, std::forward<Type>(value)} {}
 
     /**
      * @brief Copy constructor.
@@ -245,8 +235,7 @@ public:
     meta_any(meta_any &&other) ENTT_NOEXCEPT
         : storage{std::move(other.storage)},
           node{std::exchange(other.node, nullptr)},
-          vtable{std::exchange(other.vtable, &basic_vtable<void>)}
-    {}
+          vtable{std::exchange(other.vtable, &basic_vtable<void>)} {}
 
     /*! @brief Frees the internal storage, whatever it means. */
     ~meta_any() {
@@ -258,7 +247,7 @@ public:
      * @param other The instance to copy from.
      * @return This meta any object.
      */
-    meta_any & operator=(const meta_any &other) {
+    meta_any &operator=(const meta_any &other) {
         release();
         vtable = other.vtable;
         storage = other.storage;
@@ -271,7 +260,7 @@ public:
      * @param other The instance to move from.
      * @return This meta any object.
      */
-    meta_any & operator=(meta_any &&other) ENTT_NOEXCEPT {
+    meta_any &operator=(meta_any &&other) ENTT_NOEXCEPT {
         release();
         vtable = std::exchange(other.vtable, &basic_vtable<void>);
         storage = std::move(other.storage);
@@ -302,12 +291,12 @@ public:
      * @brief Returns an opaque pointer to the contained instance.
      * @return An opaque pointer the contained instance, if any.
      */
-    [[nodiscard]] const void * data() const ENTT_NOEXCEPT {
+    [[nodiscard]] const void *data() const ENTT_NOEXCEPT {
         return storage.data();
     }
 
     /*! @copydoc data */
-    [[nodiscard]] void * data() ENTT_NOEXCEPT {
+    [[nodiscard]] void *data() ENTT_NOEXCEPT {
         return storage.data();
     }
 
@@ -322,11 +311,11 @@ public:
      * @return A wrapper containing the returned value, if any.
      */
     template<typename... Args>
-    meta_any invoke(const id_type id, Args &&... args) const;
+    meta_any invoke(const id_type id, Args &&...args) const;
 
     /*! @copydoc invoke */
     template<typename... Args>
-    meta_any invoke(const id_type id, Args &&... args);
+    meta_any invoke(const id_type id, Args &&...args);
 
     /**
      * @brief Sets the value of a given variable.
@@ -358,7 +347,7 @@ public:
      * @return A (possibly null) pointer to the contained instance.
      */
     template<typename Type>
-    [[nodiscard]] const Type * try_cast() const {
+    [[nodiscard]] const Type *try_cast() const {
         if(const auto info = type_id<Type>(); node && node->info == info) {
             return any_cast<Type>(&storage);
         } else if(const auto *base = internal::visit<&internal::meta_type_node::base>([info](const auto *curr) { return curr->type->info == info; }, node); base) {
@@ -370,13 +359,13 @@ public:
 
     /*! @copydoc try_cast */
     template<typename Type>
-    [[nodiscard]] Type * try_cast() {
+    [[nodiscard]] Type *try_cast() {
         if(const auto info = type_id<Type>(); node && node->info == info) {
             return any_cast<Type>(&storage);
         } else if(const auto *base = internal::visit<&internal::meta_type_node::base>([info](const auto *curr) { return curr->type->info == info; }, node); base) {
             return static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(base->cast(static_cast<constness_as_t<any, Type> &>(storage).data())));
         }
-        
+
         return nullptr;
     }
 
@@ -393,7 +382,7 @@ public:
      */
     template<typename Type>
     [[nodiscard]] Type cast() const {
-        auto * const instance = try_cast<std::remove_reference_t<Type>>();
+        auto *const instance = try_cast<std::remove_reference_t<Type>>();
         ENTT_ASSERT(instance, "Invalid instance");
         return static_cast<Type>(*instance);
     }
@@ -402,7 +391,7 @@ public:
     template<typename Type>
     [[nodiscard]] Type cast() {
         // forces const on non-reference types to make them work also with wrappers for const references
-        auto * const instance = try_cast<std::remove_reference_t<const Type>>();
+        auto *const instance = try_cast<std::remove_reference_t<const Type>>();
         ENTT_ASSERT(instance, "Invalid instance");
         return static_cast<Type>(*instance);
     }
@@ -479,7 +468,7 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    void emplace(Args &&... args) {
+    void emplace(Args &&...args) {
         release();
         vtable = &basic_vtable<std::remove_const_t<std::remove_reference_t<Type>>>;
         storage.emplace<Type>(std::forward<Args>(args)...);
@@ -575,7 +564,6 @@ private:
     vtable_type *vtable;
 };
 
-
 /**
  * @brief Checks if two wrappers differ in their content.
  * @param lhs A wrapper, either empty or not.
@@ -586,7 +574,6 @@ private:
     return !(lhs == rhs);
 }
 
-
 /**
  * @brief Constructs a wrapper from a given type, passing it all arguments.
  * @tparam Type Type of object to use to initialize the wrapper.
@@ -595,11 +582,10 @@ private:
  * @return A properly initialized wrapper for an object of the given type.
  */
 template<typename Type, typename... Args>
-meta_any make_meta(Args &&... args) {
+meta_any make_meta(Args &&...args) {
     return meta_any{std::in_place_type<Type>, std::forward<Args>(args)...};
 }
 
-
 /**
  * @brief Forwards its argument and avoids copies for lvalue references.
  * @tparam Type Type of argument to use to construct the new instance.
@@ -611,7 +597,6 @@ meta_any forward_as_meta(Type &&value) {
     return meta_any{std::in_place_type<std::conditional_t<std::is_rvalue_reference_v<Type>, std::decay_t<Type>, Type>>, std::forward<Type>(value)};
 }
 
-
 /**
  * @brief Opaque pointers to instances of any type.
  *
@@ -623,7 +608,6 @@ struct meta_handle {
     /*! @brief Default constructor. */
     meta_handle() = default;
 
-
     /*! @brief Default copy constructor, deleted on purpose. */
     meta_handle(const meta_handle &) = delete;
 
@@ -634,13 +618,13 @@ struct meta_handle {
      * @brief Default copy assignment operator, deleted on purpose.
      * @return This meta handle.
      */
-    meta_handle & operator=(const meta_handle &) = delete;
+    meta_handle &operator=(const meta_handle &) = delete;
 
     /**
      * @brief Default move assignment operator.
      * @return This meta handle.
      */
-    meta_handle & operator=(meta_handle &&) = default;
+    meta_handle &operator=(meta_handle &&) = default;
 
     /**
      * @brief Creates a handle that points to an unmanaged object.
@@ -649,8 +633,7 @@ struct meta_handle {
      */
     template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Type>, meta_handle>>>
     meta_handle(Type &value) ENTT_NOEXCEPT
-        : meta_handle{}
-    {
+        : meta_handle{} {
         if constexpr(std::is_same_v<std::decay_t<Type>, meta_any>) {
             any = value.as_ref();
         } else {
@@ -670,12 +653,12 @@ struct meta_handle {
      * @brief Access operator for accessing the contained opaque object.
      * @return A wrapper that shares a reference to an unmanaged object.
      */
-    [[nodiscard]] meta_any * operator->() {
+    [[nodiscard]] meta_any *operator->() {
         return &any;
     }
 
     /*! @copydoc operator-> */
-    [[nodiscard]] const meta_any * operator->() const {
+    [[nodiscard]] const meta_any *operator->() const {
         return &any;
     }
 
@@ -683,7 +666,6 @@ private:
     meta_any any;
 };
 
-
 /*! @brief Opaque wrapper for properties of any type. */
 struct meta_prop {
     /*! @brief Node type. */
@@ -694,8 +676,7 @@ struct meta_prop {
      * @param curr The underlying node with which to construct the instance.
      */
     meta_prop(const node_type *curr = nullptr) ENTT_NOEXCEPT
-        : node{curr}
-    {}
+        : node{curr} {}
 
     /**
      * @brief Returns the stored key as a const reference.
@@ -725,7 +706,6 @@ private:
     const node_type *node;
 };
 
-
 /*! @brief Opaque wrapper for data members. */
 struct meta_data {
     /*! @brief Node type. */
@@ -735,8 +715,7 @@ struct meta_data {
 
     /*! @copydoc meta_prop::meta_prop */
     meta_data(const node_type *curr = nullptr) ENTT_NOEXCEPT
-        : node{curr}
-    {}
+        : node{curr} {}
 
     /*! @copydoc meta_type::id */
     [[nodiscard]] id_type id() const ENTT_NOEXCEPT {
@@ -844,7 +823,6 @@ private:
     const node_type *node;
 };
 
-
 /*! @brief Opaque wrapper for member functions. */
 struct meta_func {
     /*! @brief Node type. */
@@ -854,8 +832,7 @@ struct meta_func {
 
     /*! @copydoc meta_prop::meta_prop */
     meta_func(const node_type *curr = nullptr) ENTT_NOEXCEPT
-        : node{curr}
-    {}
+        : node{curr} {}
 
     /*! @copydoc meta_type::id */
     [[nodiscard]] id_type id() const ENTT_NOEXCEPT {
@@ -914,7 +891,7 @@ struct meta_func {
      * @param sz Number of parameters to use to invoke the function.
      * @return A wrapper containing the returned value, if any.
      */
-    meta_any invoke(meta_handle instance, meta_any * const args, const size_type sz) const {
+    meta_any invoke(meta_handle instance, meta_any *const args, const size_type sz) const {
         return sz == arity() ? node->invoke(std::move(instance), args) : meta_any{};
     }
 
@@ -929,7 +906,7 @@ struct meta_func {
      * @return A wrapper containing the new instance, if any.
      */
     template<typename... Args>
-    meta_any invoke(meta_handle instance, Args &&... args) const {
+    meta_any invoke(meta_handle instance, Args &&...args) const {
         meta_any arguments[sizeof...(Args) + 1u]{std::forward<Args>(args)...};
         return invoke(std::move(instance), arguments, sizeof...(Args));
     }
@@ -966,11 +943,10 @@ private:
     const node_type *node;
 };
 
-
 /*! @brief Opaque wrapper for types. */
 class meta_type {
     template<auto Member, typename Pred>
-    const auto * lookup(meta_any * const args, const typename internal::meta_type_node::size_type sz, Pred pred) const {
+    const auto *lookup(meta_any *const args, const typename internal::meta_type_node::size_type sz, Pred pred) const {
         std::decay_t<decltype(node->*Member)> candidate{};
         size_type extent{sz + 1u};
         bool ambiguous{};
@@ -1011,16 +987,14 @@ public:
 
     /*! @copydoc meta_prop::meta_prop */
     meta_type(const node_type *curr = nullptr) ENTT_NOEXCEPT
-        : node{curr}
-    {}
+        : node{curr} {}
 
     /**
      * @brief Constructs an instance from a given base node.
      * @param curr The base node with which to construct the instance.
      */
     meta_type(const base_node_type *curr) ENTT_NOEXCEPT
-        : node{curr ? curr->type : nullptr}
-    {}
+        : node{curr ? curr->type : nullptr} {}
 
     /**
      * @brief Returns the type info object of the underlying type.
@@ -1220,7 +1194,7 @@ public:
      * @param sz Number of parameters to use to construct the instance.
      * @return A wrapper containing the new instance, if any.
      */
-    [[nodiscard]] meta_any construct(meta_any * const args, const size_type sz) const {
+    [[nodiscard]] meta_any construct(meta_any *const args, const size_type sz) const {
         const auto *candidate = lookup<&node_type::ctor>(args, sz, [](const auto *) { return true; });
         return candidate ? candidate->invoke(args) : ((!sz && node->default_constructor) ? node->default_constructor() : meta_any{});
     }
@@ -1235,7 +1209,7 @@ public:
      * @return A wrapper containing the new instance, if any.
      */
     template<typename... Args>
-    [[nodiscard]] meta_any construct(Args &&... args) const {
+    [[nodiscard]] meta_any construct(Args &&...args) const {
         meta_any arguments[sizeof...(Args) + 1u]{std::forward<Args>(args)...};
         return construct(arguments, sizeof...(Args));
     }
@@ -1255,7 +1229,7 @@ public:
      * @param sz Number of parameters to use to invoke the function.
      * @return A wrapper containing the returned value, if any.
      */
-    meta_any invoke(const id_type id, meta_handle instance, meta_any * const args, const size_type sz) const {
+    meta_any invoke(const id_type id, meta_handle instance, meta_any *const args, const size_type sz) const {
         const auto *candidate = lookup<&node_type::func>(args, sz, [id](const auto *curr) { return curr->id == id; });
         return candidate ? candidate->invoke(std::move(instance), args) : meta_any{};
     }
@@ -1272,7 +1246,7 @@ public:
      * @return A wrapper containing the new instance, if any.
      */
     template<typename... Args>
-    meta_any invoke(const id_type id, meta_handle instance, Args &&... args) const {
+    meta_any invoke(const id_type id, meta_handle instance, Args &&...args) const {
         meta_any arguments[sizeof...(Args) + 1u]{std::forward<Args>(args)...};
         return invoke(id, std::move(instance), arguments, sizeof...(Args));
     }
@@ -1354,7 +1328,6 @@ private:
     const node_type *node;
 };
 
-
 /**
  * @brief Checks if two objects refer to the same type.
  * @param lhs An object, either valid or not.
@@ -1365,44 +1338,37 @@ private:
     return !(lhs == rhs);
 }
 
-
 [[nodiscard]] inline meta_type meta_any::type() const ENTT_NOEXCEPT {
     return node;
 }
 
-
 template<typename... Args>
-meta_any meta_any::invoke(const id_type id, Args &&... args) const {
+meta_any meta_any::invoke(const id_type id, Args &&...args) const {
     return type().invoke(id, *this, std::forward<Args>(args)...);
 }
 
-
 template<typename... Args>
-meta_any meta_any::invoke(const id_type id, Args &&... args) {
+meta_any meta_any::invoke(const id_type id, Args &&...args) {
     return type().invoke(id, *this, std::forward<Args>(args)...);
 }
 
-
 template<typename Type>
 bool meta_any::set(const id_type id, Type &&value) {
     return type().set(id, *this, std::forward<Type>(value));
 }
 
-
 [[nodiscard]] inline meta_any meta_any::get(const id_type id) const {
     return type().get(id, *this);
 }
 
-
 [[nodiscard]] inline meta_any meta_any::get(const id_type id) {
     return type().get(id, *this);
 }
 
-
 [[nodiscard]] inline meta_any meta_any::allow_cast(const meta_type &type) const {
     if(const auto info = type.info(); (node && node->info == info) || internal::visit<&internal::meta_type_node::base>([info](const auto *curr) { return curr->type->info == info; }, node)) {
         return as_ref();
-    } else if(const auto * const conv = internal::visit<&internal::meta_type_node::conv>([info](const auto *curr) { return curr->type->info == info; }, node); conv) {
+    } else if(const auto *const conv = internal::visit<&internal::meta_type_node::conv>([info](const auto *curr) { return curr->type->info == info; }, node); conv) {
         return conv->conv(storage.data());
     } else if(node && node->conversion_helper && (type.is_arithmetic() || type.is_enum())) {
         // exploits the fact that arithmetic types and enums are also default constructible
@@ -1415,31 +1381,27 @@ bool meta_any::set(const id_type id, Type &&value) {
     return {};
 }
 
-
 [[nodiscard]] inline meta_type meta_data::type() const ENTT_NOEXCEPT {
     return node->type;
 }
 
-
 [[nodiscard]] inline meta_type meta_func::ret() const ENTT_NOEXCEPT {
     return node->ret;
 }
 
-
 [[nodiscard]] inline meta_type meta_data::arg(const size_type index) const ENTT_NOEXCEPT {
     return index < arity() ? node->arg(index) : meta_type{};
 }
 
-
 [[nodiscard]] inline meta_type meta_func::arg(const size_type index) const ENTT_NOEXCEPT {
     return index < arity() ? node->arg(index) : meta_type{};
 }
 
-
 /*! @brief Opaque iterator for sequence containers. */
 class meta_sequence_container::meta_iterator {
-    enum class operation: std::uint8_t {
-        INCR, DEREF
+    enum class operation : std::uint8_t {
+        INCR,
+        DEREF
     };
 
     using vtable_type = void(const operation, const any &, void *);
@@ -1479,11 +1441,10 @@ public:
     template<typename It>
     meta_iterator(It iter)
         : vtable{&basic_vtable<It>},
-          handle{std::move(iter)}
-    {}
+          handle{std::move(iter)} {}
 
     /*! @brief Pre-increment operator. @return This iterator. */
-    meta_iterator & operator++() ENTT_NOEXCEPT {
+    meta_iterator &operator++() ENTT_NOEXCEPT {
         return vtable(operation::INCR, handle, nullptr), *this;
     }
 
@@ -1542,7 +1503,6 @@ private:
     any handle{};
 };
 
-
 /**
  * @brief Returns the meta value type of a container.
  * @return The meta value type of the container.
@@ -1551,7 +1511,6 @@ private:
     return value_type_node;
 }
 
-
 /**
  * @brief Returns the size of a container.
  * @return The size of the container.
@@ -1560,7 +1519,6 @@ private:
     return size_fn(storage);
 }
 
-
 /**
  * @brief Resizes a container to contain a given number of elements.
  * @param sz The new size of the container.
@@ -1570,7 +1528,6 @@ inline bool meta_sequence_container::resize(const size_type sz) {
     return resize_fn(storage, sz);
 }
 
-
 /**
  * @brief Clears the content of a container.
  * @return True in case of success, false otherwise.
@@ -1579,7 +1536,6 @@ inline bool meta_sequence_container::clear() {
     return clear_fn(storage);
 }
 
-
 /**
  * @brief Returns an iterator to the first element of a container.
  * @return An iterator to the first element of the container.
@@ -1588,7 +1544,6 @@ inline bool meta_sequence_container::clear() {
     return begin_fn(storage);
 }
 
-
 /**
  * @brief Returns an iterator that is past the last element of a container.
  * @return An iterator that is past the last element of the container.
@@ -1597,7 +1552,6 @@ inline bool meta_sequence_container::clear() {
     return end_fn(storage);
 }
 
-
 /**
  * @brief Inserts an element at a specified location of a container.
  * @param it Iterator before which the element will be inserted.
@@ -1608,7 +1562,6 @@ inline meta_sequence_container::iterator meta_sequence_container::insert(iterato
     return insert_fn(storage, it, value);
 }
 
-
 /**
  * @brief Removes a given element from a container.
  * @param it Iterator to the element to remove.
@@ -1618,7 +1571,6 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
     return erase_fn(storage, it);
 }
 
-
 /**
  * @brief Returns a reference to the element at a given location of a container
  * (no bounds checking is performed).
@@ -1629,7 +1581,6 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
     return get_fn(storage, pos);
 }
 
-
 /**
  * @brief Returns false if a proxy is invalid, true otherwise.
  * @return False if the proxy is invalid, true otherwise.
@@ -1638,11 +1589,11 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
     return static_cast<bool>(storage);
 }
 
-
 /*! @brief Opaque iterator for associative containers. */
 class meta_associative_container::meta_iterator {
-    enum class operation: std::uint8_t {
-        INCR, DEREF
+    enum class operation : std::uint8_t {
+        INCR,
+        DEREF
     };
 
     using vtable_type = void(const operation, const any &, void *);
@@ -1689,11 +1640,10 @@ public:
     template<bool KeyOnly, typename It>
     meta_iterator(std::integral_constant<bool, KeyOnly>, It iter)
         : vtable{&basic_vtable<KeyOnly, It>},
-          handle{std::move(iter)}
-    {}
+          handle{std::move(iter)} {}
 
     /*! @brief Pre-increment operator. @return This iterator. */
-    meta_iterator & operator++() ENTT_NOEXCEPT {
+    meta_iterator &operator++() ENTT_NOEXCEPT {
         return vtable(operation::INCR, handle, nullptr), *this;
     }
 
@@ -1744,7 +1694,6 @@ private:
     any handle{};
 };
 
-
 /**
  * @brief Returns true if a container is also key-only, false otherwise.
  * @return True if the associative container is also key-only, false otherwise.
@@ -1753,7 +1702,6 @@ private:
     return key_only_container;
 }
 
-
 /**
  * @brief Returns the meta key type of a container.
  * @return The meta key type of the a container.
@@ -1762,7 +1710,6 @@ private:
     return key_type_node;
 }
 
-
 /**
  * @brief Returns the meta mapped type of a container.
  * @return The meta mapped type of the a container.
@@ -1771,37 +1718,31 @@ private:
     return mapped_type_node;
 }
 
-
 /*! @copydoc meta_sequence_container::value_type */
 [[nodiscard]] inline meta_type meta_associative_container::value_type() const ENTT_NOEXCEPT {
     return value_type_node;
 }
 
-
 /*! @copydoc meta_sequence_container::size */
 [[nodiscard]] inline meta_associative_container::size_type meta_associative_container::size() const ENTT_NOEXCEPT {
     return size_fn(storage);
 }
 
-
 /*! @copydoc meta_sequence_container::clear */
 inline bool meta_associative_container::clear() {
     return clear_fn(storage);
 }
 
-
 /*! @copydoc meta_sequence_container::begin */
 [[nodiscard]] inline meta_associative_container::iterator meta_associative_container::begin() {
     return begin_fn(storage);
 }
 
-
 /*! @copydoc meta_sequence_container::end */
 [[nodiscard]] inline meta_associative_container::iterator meta_associative_container::end() {
     return end_fn(storage);
 }
 
-
 /**
  * @brief Inserts an element (a key/value pair) into a container.
  * @param key The key of the element to insert.
@@ -1812,7 +1753,6 @@ inline bool meta_associative_container::insert(meta_any key, meta_any value = {}
     return insert_fn(storage, key, value);
 }
 
-
 /**
  * @brief Removes the specified element from a container.
  * @param key The key of the element to remove.
@@ -1822,7 +1762,6 @@ inline bool meta_associative_container::erase(meta_any key) {
     return erase_fn(storage, key);
 }
 
-
 /**
  * @brief Returns an iterator to the element with a given key, if any.
  * @param key The key of the element to search.
@@ -1832,7 +1771,6 @@ inline bool meta_associative_container::erase(meta_any key) {
     return find_fn(storage, key);
 }
 
-
 /**
  * @brief Returns false if a proxy is invalid, true otherwise.
  * @return False if the proxy is invalid, true otherwise.
@@ -1841,8 +1779,6 @@ inline bool meta_associative_container::erase(meta_any key) {
     return static_cast<bool>(storage);
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 37 - 61
src/entt/meta/node.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_META_NODE_HPP
 #define ENTT_META_NODE_HPP
 
-
 #include <cstddef>
 #include <type_traits>
 #include <utility>
@@ -13,25 +12,20 @@
 #include "../core/type_traits.hpp"
 #include "type_traits.hpp"
 
-
 namespace entt {
 
-
 class meta_any;
 class meta_type;
 struct meta_handle;
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
-enum class meta_traits: std::uint32_t {
+enum class meta_traits : std::uint32_t {
     IS_NONE = 0x0000,
     IS_CONST = 0x0001,
     IS_STATIC = 0x0002,
@@ -46,104 +40,93 @@ enum class meta_traits: std::uint32_t {
     _entt_enum_as_bitmask
 };
 
-
 struct meta_type_node;
 
-
 struct meta_prop_node {
-    meta_prop_node * next;
+    meta_prop_node *next;
     const meta_any &id;
     meta_any &value;
 };
 
-
 struct meta_base_node {
-    meta_base_node * next;
-    meta_type_node * const type;
-    const void *(* const cast)(const void *) ENTT_NOEXCEPT;
+    meta_base_node *next;
+    meta_type_node *const type;
+    const void *(*const cast)(const void *)ENTT_NOEXCEPT;
 };
 
-
 struct meta_conv_node {
-    meta_conv_node * next;
-    meta_type_node * const type;
-    meta_any(* const conv)(const void *);
+    meta_conv_node *next;
+    meta_type_node *const type;
+    meta_any (*const conv)(const void *);
 };
 
-
 struct meta_ctor_node {
     using size_type = std::size_t;
-    meta_ctor_node * next;
+    meta_ctor_node *next;
     const size_type arity;
-    meta_type(* const arg)(const size_type) ENTT_NOEXCEPT;
-    meta_any(* const invoke)(meta_any * const);
+    meta_type (*const arg)(const size_type) ENTT_NOEXCEPT;
+    meta_any (*const invoke)(meta_any *const);
 };
 
-
 struct meta_data_node {
     using size_type = std::size_t;
     id_type id;
-    meta_data_node * next;
-    meta_prop_node * prop;
+    meta_data_node *next;
+    meta_prop_node *prop;
     const size_type arity;
     const meta_traits traits;
-    meta_type_node * const type;
-    meta_type(* const arg)(const size_type) ENTT_NOEXCEPT;
-    bool(* const set)(meta_handle, meta_any);
-    meta_any(* const get)(meta_handle);
+    meta_type_node *const type;
+    meta_type (*const arg)(const size_type) ENTT_NOEXCEPT;
+    bool (*const set)(meta_handle, meta_any);
+    meta_any (*const get)(meta_handle);
 };
 
-
 struct meta_func_node {
     using size_type = std::size_t;
     id_type id;
-    meta_func_node * next;
-    meta_prop_node * prop;
+    meta_func_node *next;
+    meta_prop_node *prop;
     const size_type arity;
     const meta_traits traits;
-    meta_type_node * const ret;
-    meta_type(* const arg)(const size_type) ENTT_NOEXCEPT;
-    meta_any(* const invoke)(meta_handle, meta_any * const);
+    meta_type_node *const ret;
+    meta_type (*const arg)(const size_type) ENTT_NOEXCEPT;
+    meta_any (*const invoke)(meta_handle, meta_any *const);
 };
 
-
 struct meta_template_node {
     using size_type = std::size_t;
     const size_type arity;
-    meta_type_node * const type;
-    meta_type_node *(* const arg)(const size_type) ENTT_NOEXCEPT;
+    meta_type_node *const type;
+    meta_type_node *(*const arg)(const size_type)ENTT_NOEXCEPT;
 };
 
-
 struct meta_type_node {
     using size_type = std::size_t;
     const type_info info;
     id_type id;
-    meta_type_node * next;
-    meta_prop_node * prop;
+    meta_type_node *next;
+    meta_prop_node *prop;
     const size_type size_of;
     const meta_traits traits;
-    meta_any(* const default_constructor)();
-    double(* const conversion_helper)(const any &, const any &);
+    meta_any (*const default_constructor)();
+    double (*const conversion_helper)(const any &, const any &);
     const meta_template_node *const templ;
     meta_ctor_node *ctor{nullptr};
     meta_base_node *base{nullptr};
     meta_conv_node *conv{nullptr};
     meta_data_node *data{nullptr};
     meta_func_node *func{nullptr};
-    void(* dtor)(void *){nullptr};
+    void (*dtor)(void *){nullptr};
 };
 
-
 template<typename... Args>
-meta_type_node * meta_arg_node(type_list<Args...>, const std::size_t index) ENTT_NOEXCEPT;
-
+meta_type_node *meta_arg_node(type_list<Args...>, const std::size_t index) ENTT_NOEXCEPT;
 
 template<typename Type>
 class ENTT_API meta_node {
     static_assert(std::is_same_v<Type, std::remove_cv_t<std::remove_reference_t<Type>>>, "Invalid type");
 
-    [[nodiscard]] static auto * meta_default_constructor() ENTT_NOEXCEPT {
+    [[nodiscard]] static auto *meta_default_constructor() ENTT_NOEXCEPT {
         if constexpr(std::is_default_constructible_v<Type>) {
             return +[]() { return meta_any{std::in_place_type<Type>}; };
         } else {
@@ -151,7 +134,7 @@ class ENTT_API meta_node {
         }
     }
 
-    [[nodiscard]] static auto * meta_conversion_helper() ENTT_NOEXCEPT {
+    [[nodiscard]] static auto *meta_conversion_helper() ENTT_NOEXCEPT {
         if constexpr(std::is_arithmetic_v<Type>) {
             return +[](const any &storage, const any &value) {
                 return value ? static_cast<double>(any_cast<Type &>(const_cast<any &>(storage)) = static_cast<Type>(any_cast<double>(value))) : static_cast<double>(any_cast<const Type &>(storage));
@@ -165,7 +148,7 @@ class ENTT_API meta_node {
         }
     }
 
-    [[nodiscard]] static meta_template_node * meta_template_info() ENTT_NOEXCEPT {
+    [[nodiscard]] static meta_template_node *meta_template_info() ENTT_NOEXCEPT {
         if constexpr(is_complete_v<meta_template_traits<Type>>) {
             static meta_template_node node{
                 meta_template_traits<Type>::args_type::size,
@@ -181,7 +164,7 @@ class ENTT_API meta_node {
     }
 
 public:
-    [[nodiscard]] static meta_type_node * resolve() ENTT_NOEXCEPT {
+    [[nodiscard]] static meta_type_node *resolve() ENTT_NOEXCEPT {
         static meta_type_node node{
             type_id<Type>(),
             {},
@@ -207,14 +190,12 @@ public:
     }
 };
 
-
 template<typename... Args>
-[[nodiscard]] meta_type_node * meta_arg_node(type_list<Args...>, const std::size_t index) ENTT_NOEXCEPT {
+[[nodiscard]] meta_type_node *meta_arg_node(type_list<Args...>, const std::size_t index) ENTT_NOEXCEPT {
     meta_type_node *args[sizeof...(Args) + 1u]{nullptr, internal::meta_node<std::remove_const_t<std::remove_reference_t<Args>>>::resolve()...};
     return args[index + 1u];
 }
 
-
 template<auto Member, typename Op>
 [[nodiscard]] static std::decay_t<decltype(std::declval<internal::meta_type_node>().*Member)> visit(const Op &op, const internal::meta_type_node *node) {
     if(!node) {
@@ -236,7 +217,6 @@ template<auto Member, typename Op>
     return nullptr;
 }
 
-
 [[nodiscard]] inline bool can_cast_or_convert(const internal::meta_type_node *type, const internal::meta_type_node *other) ENTT_NOEXCEPT {
     if(type->info == other->info) {
         return true;
@@ -257,17 +237,13 @@ template<auto Member, typename Op>
     return (type->conversion_helper && other->conversion_helper);
 }
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
-}
-
+} // namespace entt
 
 #endif

+ 6 - 18
src/entt/meta/pointer.hpp

@@ -1,24 +1,19 @@
 #ifndef ENTT_META_POINTER_HPP
 #define ENTT_META_POINTER_HPP
 
-
 #include <memory>
 #include <type_traits>
 #include "type_traits.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Makes plain pointers pointer-like types for the meta system.
  * @tparam Type Element type.
  */
 template<typename Type>
 struct is_meta_pointer_like<Type *>
-        : std::true_type
-{};
-
+    : std::true_type {};
 
 /**
  * @brief Partial specialization used to reject pointers to arrays.
@@ -26,10 +21,8 @@ struct is_meta_pointer_like<Type *>
  * @tparam N Number of elements of the array.
  */
 template<typename Type, std::size_t N>
-struct is_meta_pointer_like<Type(*)[N]>
-    : std::false_type
-{};
-
+struct is_meta_pointer_like<Type (*)[N]>
+    : std::false_type {};
 
 /**
  * @brief Makes `std::shared_ptr`s of any type pointer-like types for the meta
@@ -38,9 +31,7 @@ struct is_meta_pointer_like<Type(*)[N]>
  */
 template<typename Type>
 struct is_meta_pointer_like<std::shared_ptr<Type>>
-        : std::true_type
-{};
-
+    : std::true_type {};
 
 /**
  * @brief Makes `std::unique_ptr`s of any type pointer-like types for the meta
@@ -50,11 +41,8 @@ struct is_meta_pointer_like<std::shared_ptr<Type>>
  */
 template<typename Type, typename... Args>
 struct is_meta_pointer_like<std::unique_ptr<Type, Args...>>
-        : std::true_type
-{};
-
-
-}
+    : std::true_type {};
 
+} // namespace entt
 
 #endif

+ 1 - 8
src/entt/meta/policy.hpp

@@ -1,27 +1,20 @@
 #ifndef ENTT_META_POLICY_HPP
 #define ENTT_META_POLICY_HPP
 
-
 namespace entt {
 
-
 /*! @brief Empty class type used to request the _as ref_ policy. */
 struct as_ref_t {};
 
-
 /*! @brief Empty class type used to request the _as cref_ policy. */
 struct as_cref_t {};
 
-
 /*! @brief Empty class type used to request the _as-is_ policy. */
 struct as_is_t {};
 
-
 /*! @brief Empty class type used to request the _as void_ policy. */
 struct as_void_t {};
 
-
-}
-
+} // namespace entt
 
 #endif

+ 4 - 11
src/entt/meta/range.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_META_RANGE_HPP
 #define ENTT_META_RANGE_HPP
 
-
 #include <cstddef>
 #include <iterator>
 
-
 namespace entt {
 
-
 /**
  * @brief Iterable range to use to iterate all types of meta objects.
  * @tparam Type Type of meta objects returned.
@@ -27,10 +24,9 @@ class meta_range {
         range_iterator() ENTT_NOEXCEPT = default;
 
         range_iterator(node_type *head) ENTT_NOEXCEPT
-            : it{head}
-        {}
+            : it{head} {}
 
-        range_iterator & operator++() ENTT_NOEXCEPT {
+        range_iterator &operator++() ENTT_NOEXCEPT {
             return (it = it->next), *this;
         }
 
@@ -71,8 +67,7 @@ public:
      * @param head The underlying node with which to construct the range.
      */
     meta_range(node_type *head)
-        : node{head}
-    {}
+        : node{head} {}
 
     /**
      * @brief Returns an iterator to the beginning.
@@ -105,8 +100,6 @@ private:
     node_type *node{nullptr};
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 9
src/entt/meta/resolve.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_META_RESOLVE_HPP
 #define ENTT_META_RESOLVE_HPP
 
-
 #include <algorithm>
 #include "../core/type_info.hpp"
 #include "ctx.hpp"
@@ -9,10 +8,8 @@
 #include "node.hpp"
 #include "range.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Returns the meta type associated with a given type.
  * @tparam Type Type to use to search for a meta type.
@@ -23,7 +20,6 @@ template<typename Type>
     return internal::meta_node<std::remove_const_t<std::remove_reference_t<Type>>>::resolve();
 }
 
-
 /**
  * @brief Returns a range to use to visit all meta types.
  * @return An iterable range to use to visit all meta types.
@@ -32,7 +28,6 @@ template<typename Type>
     return *internal::meta_context::global();
 }
 
-
 /**
  * @brief Returns the meta type associated with a given identifier, if any.
  * @param id Unique identifier.
@@ -48,7 +43,6 @@ template<typename Type>
     return {};
 }
 
-
 /**
  * @brief Returns the meta type associated with a given type info object, if
  * any.
@@ -65,8 +59,6 @@ template<typename Type>
     return {};
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 7
src/entt/meta/template.hpp

@@ -1,18 +1,14 @@
 #ifndef ENTT_META_TEMPLATE_HPP
 #define ENTT_META_TEMPLATE_HPP
 
-
 #include "../core/type_traits.hpp"
 
-
 namespace entt {
 
-
 /*! @brief Utility class to disambiguate class templates. */
 template<template<typename...> typename>
 struct meta_class_template_tag {};
 
-
 /**
  * @brief General purpose traits class for generating meta template information.
  * @tparam Clazz Type of class template.
@@ -26,8 +22,6 @@ struct meta_template_traits<Clazz<Args...>> {
     using args_type = type_list<Args...>;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 11
src/entt/meta/type_traits.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_META_TYPE_TRAITS_HPP
 #define ENTT_META_TYPE_TRAITS_HPP
 
-
 #include <type_traits>
 #include <utility>
 
-
 namespace entt {
 
-
 /**
  * @brief Traits class template to be specialized to enable support for meta
  * template information.
@@ -16,7 +13,6 @@ namespace entt {
 template<typename>
 struct meta_template_traits;
 
-
 /**
  * @brief Traits class template to be specialized to enable support for meta
  * sequence containers.
@@ -24,7 +20,6 @@ struct meta_template_traits;
 template<typename>
 struct meta_sequence_container_traits;
 
-
 /**
  * @brief Traits class template to be specialized to enable support for meta
  * associative containers.
@@ -32,7 +27,6 @@ struct meta_sequence_container_traits;
 template<typename>
 struct meta_associative_container_traits;
 
-
 /**
  * @brief Provides the member constant `value` to true if a given type is a
  * pointer-like type from the point of view of the meta system, false otherwise.
@@ -41,7 +35,6 @@ struct meta_associative_container_traits;
 template<typename>
 struct is_meta_pointer_like: std::false_type {};
 
-
 /**
  * @brief Partial specialization to ensure that const pointer-like types are
  * also accepted.
@@ -50,7 +43,6 @@ struct is_meta_pointer_like: std::false_type {};
 template<typename Type>
 struct is_meta_pointer_like<const Type>: is_meta_pointer_like<Type> {};
 
-
 /**
  * @brief Helper variable template.
  * @tparam Type Potentially pointer-like type.
@@ -58,8 +50,6 @@ struct is_meta_pointer_like<const Type>: is_meta_pointer_like<Type> {};
 template<typename Type>
 inline constexpr auto is_meta_pointer_like_v = is_meta_pointer_like<Type>::value;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 32 - 58
src/entt/meta/utility.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_META_UTILITY_HPP
 #define ENTT_META_UTILITY_HPP
 
-
 #include <cstddef>
 #include <functional>
 #include <type_traits>
@@ -12,15 +11,12 @@
 #include "node.hpp"
 #include "policy.hpp"
 
-
 namespace entt {
 
-
 /*! @brief Primary template isn't defined on purpose. */
 template<typename, typename>
 struct meta_function_descriptor;
 
-
 /**
  * @brief Meta function descriptor.
  * @tparam Type Reflected type to which the meta function is associated.
@@ -29,7 +25,7 @@ struct meta_function_descriptor;
  * @tparam Args Function arguments.
  */
 template<typename Type, typename Ret, typename Class, typename... Args>
-struct meta_function_descriptor<Type, Ret(Class:: *)(Args...) const> {
+struct meta_function_descriptor<Type, Ret (Class::*)(Args...) const> {
     /*! @brief Meta function return type. */
     using return_type = Ret;
     /*! @brief Meta function arguments. */
@@ -41,7 +37,6 @@ struct meta_function_descriptor<Type, Ret(Class:: *)(Args...) const> {
     static constexpr auto is_static = !std::is_same_v<Type, Class>;
 };
 
-
 /**
  * @brief Meta function descriptor.
  * @tparam Type Reflected type to which the meta function is associated.
@@ -50,7 +45,7 @@ struct meta_function_descriptor<Type, Ret(Class:: *)(Args...) const> {
  * @tparam Args Function arguments.
  */
 template<typename Type, typename Ret, typename Class, typename... Args>
-struct meta_function_descriptor<Type, Ret(Class:: *)(Args...)> {
+struct meta_function_descriptor<Type, Ret (Class::*)(Args...)> {
     /*! @brief Meta function return type. */
     using return_type = Ret;
     /*! @brief Meta function arguments. */
@@ -62,7 +57,6 @@ struct meta_function_descriptor<Type, Ret(Class:: *)(Args...)> {
     static constexpr auto is_static = !std::is_same_v<Type, Class>;
 };
 
-
 /**
  * @brief Meta function descriptor.
  * @tparam Type Reflected type to which the meta data is associated.
@@ -70,7 +64,7 @@ struct meta_function_descriptor<Type, Ret(Class:: *)(Args...)> {
  * @tparam Ret Data member type.
  */
 template<typename Type, typename Ret, typename Class>
-struct meta_function_descriptor<Type, Ret Class:: *> {
+struct meta_function_descriptor<Type, Ret Class::*> {
     /*! @brief Meta data return type. */
     using return_type = Ret;
     /*! @brief Meta data arguments. */
@@ -82,7 +76,6 @@ struct meta_function_descriptor<Type, Ret Class:: *> {
     static constexpr auto is_static = false;
 };
 
-
 /**
  * @brief Meta function descriptor.
  * @tparam Type Reflected type to which the meta function is associated.
@@ -90,7 +83,7 @@ struct meta_function_descriptor<Type, Ret Class:: *> {
  * @tparam Args Function arguments.
  */
 template<typename Type, typename Ret, typename... Args>
-struct meta_function_descriptor<Type, Ret(*)(Args...)> {
+struct meta_function_descriptor<Type, Ret (*)(Args...)> {
     /*! @brief Meta function return type. */
     using return_type = Ret;
     /*! @brief Meta function arguments. */
@@ -102,7 +95,6 @@ struct meta_function_descriptor<Type, Ret(*)(Args...)> {
     static constexpr auto is_static = true;
 };
 
-
 /**
  * @brief Meta function helper.
  *
@@ -115,16 +107,16 @@ struct meta_function_descriptor<Type, Ret(*)(Args...)> {
 template<typename Type, typename Candidate>
 class meta_function_helper {
     template<typename Ret, typename... Args, typename Class>
-    static constexpr meta_function_descriptor<Type, Ret(Class:: *)(Args...) const> get_rid_of_noexcept(Ret(Class:: *)(Args...) const);
+    static constexpr meta_function_descriptor<Type, Ret (Class::*)(Args...) const> get_rid_of_noexcept(Ret (Class::*)(Args...) const);
 
     template<typename Ret, typename... Args, typename Class>
-    static constexpr meta_function_descriptor<Type, Ret(Class:: *)(Args...)> get_rid_of_noexcept(Ret(Class:: *)(Args...));
+    static constexpr meta_function_descriptor<Type, Ret (Class::*)(Args...)> get_rid_of_noexcept(Ret (Class::*)(Args...));
 
     template<typename Ret, typename Class>
-    static constexpr meta_function_descriptor<Type, Ret Class:: *> get_rid_of_noexcept(Ret Class:: *);
+    static constexpr meta_function_descriptor<Type, Ret Class::*> get_rid_of_noexcept(Ret Class::*);
 
     template<typename Ret, typename... Args>
-    static constexpr meta_function_descriptor<Type, Ret(*)(Args...)> get_rid_of_noexcept(Ret(*)(Args...));
+    static constexpr meta_function_descriptor<Type, Ret (*)(Args...)> get_rid_of_noexcept(Ret (*)(Args...));
 
     template<typename Class>
     static constexpr meta_function_descriptor<Class, decltype(&Class::operator())> get_rid_of_noexcept(Class);
@@ -134,7 +126,6 @@ public:
     using type = decltype(get_rid_of_noexcept(std::declval<Candidate>()));
 };
 
-
 /**
  * @brief Helper type.
  * @tparam Type Reflected type to which the meta function is associated.
@@ -143,7 +134,6 @@ public:
 template<typename Type, typename Candidate>
 using meta_function_helper_t = typename meta_function_helper<Type, Candidate>::type;
 
-
 /**
  * @brief Wraps a value depending on the given policy.
  * @tparam Policy Optional policy (no policy set by default).
@@ -166,7 +156,6 @@ meta_any meta_dispatch([[maybe_unused]] Type &&value) {
     }
 }
 
-
 /**
  * @brief Returns the meta type of the i-th element of a list of arguments.
  * @tparam Type Type list of the actual types of arguments.
@@ -177,7 +166,6 @@ template<typename Type>
     return internal::meta_arg_node(Type{}, index);
 }
 
-
 /**
  * @brief Sets the value of a given variable.
  * @tparam Type Reflected type to which the variable is associated.
@@ -192,14 +180,14 @@ template<typename Type, auto Data>
         if constexpr(std::is_function_v<std::remove_reference_t<std::remove_pointer_t<decltype(Data)>>>) {
             using data_type = type_list_element_t<1u, typename meta_function_helper_t<Type, decltype(Data)>::args_type>;
 
-            if(auto * const clazz = instance->try_cast<Type>(); clazz && value.allow_cast<data_type>()) {
+            if(auto *const clazz = instance->try_cast<Type>(); clazz && value.allow_cast<data_type>()) {
                 Data(*clazz, value.cast<data_type>());
                 return true;
             }
         } else if constexpr(std::is_member_function_pointer_v<decltype(Data)>) {
             using data_type = type_list_element_t<0u, typename meta_function_helper_t<Type, decltype(Data)>::args_type>;
 
-            if(auto * const clazz = instance->try_cast<Type>(); clazz && value.allow_cast<data_type>()) {
+            if(auto *const clazz = instance->try_cast<Type>(); clazz && value.allow_cast<data_type>()) {
                 (clazz->*Data)(value.cast<data_type>());
                 return true;
             }
@@ -207,7 +195,7 @@ template<typename Type, auto Data>
             using data_type = std::remove_reference_t<decltype(std::declval<Type>().*Data)>;
 
             if constexpr(!std::is_array_v<data_type> && !std::is_const_v<data_type>) {
-                if(auto * const clazz = instance->try_cast<Type>(); clazz && value.allow_cast<data_type>()) {
+                if(auto *const clazz = instance->try_cast<Type>(); clazz && value.allow_cast<data_type>()) {
                     clazz->*Data = value.cast<data_type>();
                     return true;
                 }
@@ -227,7 +215,6 @@ template<typename Type, auto Data>
     return false;
 }
 
-
 /**
  * @brief Gets the value of a given variable.
  * @tparam Type Reflected type to which the variable is associated.
@@ -239,16 +226,16 @@ template<typename Type, auto Data>
 template<typename Type, auto Data, typename Policy = as_is_t>
 [[nodiscard]] meta_any meta_getter([[maybe_unused]] meta_handle instance) {
     if constexpr(std::is_function_v<std::remove_reference_t<std::remove_pointer_t<decltype(Data)>>>) {
-        auto * const clazz = instance->try_cast<std::conditional_t<std::is_invocable_v<decltype(Data), const Type &>, const Type, Type>>();
+        auto *const clazz = instance->try_cast<std::conditional_t<std::is_invocable_v<decltype(Data), const Type &>, const Type, Type>>();
         return clazz ? meta_dispatch<Policy>(Data(*clazz)) : meta_any{};
     } else if constexpr(std::is_member_function_pointer_v<decltype(Data)>) {
-        auto * const clazz = instance->try_cast<std::conditional_t<std::is_invocable_v<decltype(Data), const Type &>, const Type, Type>>();
+        auto *const clazz = instance->try_cast<std::conditional_t<std::is_invocable_v<decltype(Data), const Type &>, const Type, Type>>();
         return clazz ? meta_dispatch<Policy>((clazz->*Data)()) : meta_any{};
     } else if constexpr(std::is_member_object_pointer_v<decltype(Data)>) {
         if constexpr(!std::is_array_v<std::remove_cv_t<std::remove_reference_t<decltype(std::declval<Type>().*Data)>>>) {
-            if(auto * clazz = instance->try_cast<Type>(); clazz) {
+            if(auto *clazz = instance->try_cast<Type>(); clazz) {
                 return meta_dispatch<Policy>(clazz->*Data);
-            } else if(auto * fallback = instance->try_cast<const Type>(); fallback) {
+            } else if(auto *fallback = instance->try_cast<const Type>(); fallback) {
                 return meta_dispatch<Policy>(fallback->*Data);
             }
         }
@@ -265,21 +252,18 @@ template<typename Type, auto Data, typename Policy = as_is_t>
     }
 }
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename Type, typename Policy = as_is_t, typename Candidate, std::size_t... Index>
 [[nodiscard]] meta_any meta_invoke([[maybe_unused]] meta_handle instance, Candidate &&candidate, meta_any *args, std::index_sequence<Index...>) {
     using descriptor = meta_function_helper_t<Type, Candidate>;
 
-    const auto invoke = [&candidate](auto &&maybe_clazz, auto &&... other) {
+    const auto invoke = [&candidate](auto &&maybe_clazz, auto &&...other) {
         if constexpr(std::is_member_function_pointer_v<std::remove_reference_t<Candidate>>) {
             if constexpr(std::is_void_v<typename descriptor::return_type>) {
                 (std::forward<decltype(maybe_clazz)>(maybe_clazz).*std::forward<Candidate>(candidate))(std::forward<decltype(other)>(other)...);
@@ -298,42 +282,38 @@ template<typename Type, typename Policy = as_is_t, typename Candidate, std::size
     };
 
     if constexpr(std::is_invocable_v<std::remove_reference_t<Candidate>, const Type &, type_list_element_t<Index, typename descriptor::args_type>...>) {
-        if(const auto * const clazz = instance->try_cast<const Type>(); clazz && ((args+Index)->allow_cast<type_list_element_t<Index, typename descriptor::args_type>>() && ...)) {
-            return invoke(*clazz, (args+Index)->cast<type_list_element_t<Index, typename descriptor::args_type>>()...);
+        if(const auto *const clazz = instance->try_cast<const Type>(); clazz && ((args + Index)->allow_cast<type_list_element_t<Index, typename descriptor::args_type>>() && ...)) {
+            return invoke(*clazz, (args + Index)->cast<type_list_element_t<Index, typename descriptor::args_type>>()...);
         }
     } else if constexpr(std::is_invocable_v<std::remove_reference_t<Candidate>, Type &, type_list_element_t<Index, typename descriptor::args_type>...>) {
-        if(auto * const clazz = instance->try_cast<Type>(); clazz && ((args+Index)->allow_cast<type_list_element_t<Index, typename descriptor::args_type>>() && ...)) {
-            return invoke(*clazz, (args+Index)->cast<type_list_element_t<Index, typename descriptor::args_type>>()...);
+        if(auto *const clazz = instance->try_cast<Type>(); clazz && ((args + Index)->allow_cast<type_list_element_t<Index, typename descriptor::args_type>>() && ...)) {
+            return invoke(*clazz, (args + Index)->cast<type_list_element_t<Index, typename descriptor::args_type>>()...);
         }
     } else {
-        if(((args+Index)->allow_cast<type_list_element_t<Index, typename descriptor::args_type>>() && ...)) {
-            return invoke((args+Index)->cast<type_list_element_t<Index, typename descriptor::args_type>>()...);
+        if(((args + Index)->allow_cast<type_list_element_t<Index, typename descriptor::args_type>>() && ...)) {
+            return invoke((args + Index)->cast<type_list_element_t<Index, typename descriptor::args_type>>()...);
         }
     }
 
     return meta_any{};
 }
 
-
 template<typename Type, typename... Args, std::size_t... Index>
-[[nodiscard]] meta_any meta_construct(meta_any * const args, std::index_sequence<Index...>) {
-    if(((args+Index)->allow_cast<Args>() && ...)) {
-        return Type{(args+Index)->cast<Args>()...};
+[[nodiscard]] meta_any meta_construct(meta_any *const args, std::index_sequence<Index...>) {
+    if(((args + Index)->allow_cast<Args>() && ...)) {
+        return Type{(args + Index)->cast<Args>()...};
     }
 
     return meta_any{};
 }
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /**
  * @brief Invokes a callable object given a list of erased parameters, if
  * possible.
@@ -346,7 +326,7 @@ template<typename Type, typename... Args, std::size_t... Index>
  * @return A meta any containing the returned value, if any.
  */
 template<typename Type, typename Policy = as_is_t, typename Candidate>
-[[nodiscard]] meta_any meta_invoke([[maybe_unused]] meta_handle instance, Candidate &&candidate, [[maybe_unused]] meta_any * const args) {
+[[nodiscard]] meta_any meta_invoke([[maybe_unused]] meta_handle instance, Candidate &&candidate, [[maybe_unused]] meta_any *const args) {
     if constexpr(std::is_invocable_v<std::remove_reference_t<Candidate>>) {
         if constexpr(std::is_void_v<decltype(std::forward<Candidate>(candidate)())>) {
             std::forward<Candidate>(candidate)();
@@ -359,7 +339,6 @@ template<typename Type, typename Policy = as_is_t, typename Candidate>
     }
 }
 
-
 /**
  * @brief Invokes a function given a list of erased parameters, if possible.
  * @tparam Type Reflected type to which the function is associated.
@@ -370,11 +349,10 @@ template<typename Type, typename Policy = as_is_t, typename Candidate>
  * @return A meta any containing the returned value, if any.
  */
 template<typename Type, auto Candidate, typename Policy = as_is_t>
-[[nodiscard]] meta_any meta_invoke(meta_handle instance, meta_any * const args) {
+[[nodiscard]] meta_any meta_invoke(meta_handle instance, meta_any *const args) {
     return meta_invoke<Type, Policy>(std::move(instance), Candidate, args);
 }
 
-
 /**
  * @brief Constructs an instance given a list of erased parameters, if possible.
  * @tparam Type Actual type of the instance to construct.
@@ -383,11 +361,10 @@ template<typename Type, auto Candidate, typename Policy = as_is_t>
  * @return A meta any containing the new instance, if any.
  */
 template<typename Type, typename... Args>
-[[nodiscard]] meta_any meta_construct(meta_any * const args) {
+[[nodiscard]] meta_any meta_construct(meta_any *const args) {
     return internal::meta_construct<Type, Args...>(args, std::index_sequence_for<Args...>{});
 }
 
-
 /**
  * @brief Constructs an instance given a list of erased parameters, if possible.
  * @tparam Type Reflected type to which the callable object is associated.
@@ -398,11 +375,10 @@ template<typename Type, typename... Args>
  * @return A meta any containing the returned value, if any.
  */
 template<typename Type, typename Policy = as_is_t, typename Candidate>
-[[nodiscard]] meta_any meta_construct(Candidate &&candidate, meta_any * const args) {
+[[nodiscard]] meta_any meta_construct(Candidate &&candidate, meta_any *const args) {
     return meta_invoke<Type, Policy>({}, std::forward<Candidate>(candidate), args);
 }
 
-
 /**
  * @brief Constructs an instance given a list of erased parameters, if possible.
  * @tparam Type Reflected type to which the function is associated.
@@ -412,12 +388,10 @@ template<typename Type, typename Policy = as_is_t, typename Candidate>
  * @return A meta any containing the returned value, if any.
  */
 template<typename Type, auto Candidate, typename Policy = as_is_t>
-[[nodiscard]] meta_any meta_construct(meta_any * const args) {
+[[nodiscard]] meta_any meta_construct(meta_any *const args) {
     return meta_invoke<Type, Policy>({}, Candidate, args);
 }
 
-
-}
-
+} // namespace entt
 
 #endif

+ 9 - 28
src/entt/platform/android-ndk-r17.hpp

@@ -1,37 +1,29 @@
 #ifndef ENTT_PLATFORM_ANDROID_NDK_R17_HPP
 #define ENTT_PLATFORM_ANDROID_NDK_R17_HPP
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 #ifdef __ANDROID__
-#include <android/ndk-version.h>
-#if __NDK_MAJOR__ == 17
-
-
-#include <functional>
-#include <type_traits>
-#include <utility>
+#    include <android/ndk-version.h>
+#    if __NDK_MAJOR__ == 17
 
+#        include <functional>
+#        include <type_traits>
+#        include <utility>
 
 namespace std {
 
-
 namespace internal {
 
-
 template<typename Func, typename... Args>
 constexpr auto is_invocable(int) -> decltype(std::invoke(std::declval<Func>(), std::declval<Args>()...), std::true_type{});
 
-
 template<typename, typename...>
 constexpr std::false_type is_invocable(...);
 
-
 template<typename Ret, typename Func, typename... Args>
 constexpr auto is_invocable_r(int)
 -> std::enable_if_t<decltype(std::is_convertible_v<decltype(std::invoke(std::declval<Func>(), std::declval<Args>()...)), Ret>, std::true_type>;
@@ -40,47 +32,36 @@ constexpr auto is_invocable_r(int)
 template<typename, typename, typename...>
 constexpr std::false_type is_invocable_r(...);
 
-
-}
-
+} // namespace internal
 
 template<typename Func, typename... Args>
 struct is_invocable: decltype(internal::is_invocable<Func, Args...>(0)) {};
 
-
 template<typename Func, typename... Argsv>
 inline constexpr bool is_invocable_v = std::is_invocable<Func, Args...>::value;
 
-
 template<typename Ret, typename Func, typename... Args>
 struct is_invocable_r: decltype(internal::is_invocable_r<Ret, Func, Args...>(0)) {};
 
-
 template<typename Ret, typename Func, typename... Args>
 inline constexpr bool is_invocable_r_v = std::is_invocable_r<Ret, Func, Args...>::value;
 
-
-template<typename Func, typename...Args>
+template<typename Func, typename... Args>
 struct invoke_result {
     using type = decltype(std::invoke(std::declval<Func>(), std::declval<Args>()...));
 };
 
-
 template<typename Func, typename... Args>
 using invoke_result_t = typename std::invoke_result<Func, Args...>::type;
 
+} // namespace std
 
-}
-
-
-#endif
+#    endif
 #endif
 
-
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 #endif

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

@@ -1,17 +1,13 @@
 #ifndef ENTT_POLY_FWD_HPP
 #define ENTT_POLY_FWD_HPP
 
-
 #include <type_traits>
 
-
 namespace entt {
 
-
 template<typename, std::size_t Len, std::size_t = alignof(typename std::aligned_storage_t<Len + !Len>)>
 class basic_poly;
 
-
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Concept Concept descriptor.
@@ -19,8 +15,6 @@ class basic_poly;
 template<typename Concept>
 using poly = basic_poly<Concept, sizeof(double[2])>;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 25 - 37
src/entt/poly/poly.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_POLY_POLY_HPP
 #define ENTT_POLY_POLY_HPP
 
-
 #include <cstddef>
 #include <functional>
 #include <tuple>
@@ -13,17 +12,15 @@
 #include "../core/type_traits.hpp"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /*! @brief Inspector class used to infer the type of the virtual table. */
 struct poly_inspector {
     /**
      * @brief Generic conversion operator (definition only).
      * @tparam Type Type to which conversion is requested.
      */
-    template <class Type>
+    template<class Type>
     operator Type &&() const;
 
     /**
@@ -34,14 +31,13 @@ struct poly_inspector {
      * @return A poly inspector convertible to any type.
      */
     template<auto Member, typename... Args>
-    poly_inspector invoke(Args &&... args) const;
+    poly_inspector invoke(Args &&...args) const;
 
     /*! @copydoc invoke */
     template<auto Member, typename... Args>
-    poly_inspector invoke(Args &&... args);
+    poly_inspector invoke(Args &&...args);
 };
 
-
 /**
  * @brief Static virtual table factory.
  * @tparam Concept Concept descriptor.
@@ -53,35 +49,35 @@ class poly_vtable {
     using inspector = typename Concept::template type<poly_inspector>;
 
     template<typename Ret, typename... Args>
-    static auto vtable_entry(Ret(*)(inspector &, Args...)) -> Ret(*)(basic_any<Len, Align> &, Args...);
+    static auto vtable_entry(Ret (*)(inspector &, Args...)) -> Ret (*)(basic_any<Len, Align> &, Args...);
 
     template<typename Ret, typename... Args>
-    static auto vtable_entry(Ret(*)(const inspector &, Args...)) -> Ret(*)(const basic_any<Len, Align> &, Args...);
+    static auto vtable_entry(Ret (*)(const inspector &, Args...)) -> Ret (*)(const basic_any<Len, Align> &, Args...);
 
     template<typename Ret, typename... Args>
-    static auto vtable_entry(Ret(*)(Args...)) -> Ret(*)(const basic_any<Len, Align> &, Args...);
+    static auto vtable_entry(Ret (*)(Args...)) -> Ret (*)(const basic_any<Len, Align> &, Args...);
 
     template<typename Ret, typename... Args>
-    static auto vtable_entry(Ret(inspector:: *)(Args...)) -> Ret(*)(basic_any<Len, Align> &, Args...);
+    static auto vtable_entry(Ret (inspector::*)(Args...)) -> Ret (*)(basic_any<Len, Align> &, Args...);
 
     template<typename Ret, typename... Args>
-    static auto vtable_entry(Ret(inspector:: *)(Args...) const) -> Ret(*)(const basic_any<Len, Align> &, Args...);
+    static auto vtable_entry(Ret (inspector::*)(Args...) const) -> Ret (*)(const basic_any<Len, Align> &, Args...);
 
     template<auto... Candidate>
     static auto make_vtable(value_list<Candidate...>)
-    -> decltype(std::make_tuple(vtable_entry(Candidate)...));
+        -> decltype(std::make_tuple(vtable_entry(Candidate)...));
 
     template<typename... Func>
-    [[nodiscard]] static constexpr auto make_vtable(type_list<Func...>)  {
+    [[nodiscard]] static constexpr auto make_vtable(type_list<Func...>) {
         if constexpr(sizeof...(Func) == 0u) {
             return decltype(make_vtable(typename Concept::template impl<inspector>{})){};
         } else if constexpr((std::is_function_v<Func> && ...)) {
-            return decltype(std::make_tuple(vtable_entry(std::declval<Func inspector:: *>())...)){};
+            return decltype(std::make_tuple(vtable_entry(std::declval<Func inspector::*>())...)){};
         }
     }
 
     template<typename Type, auto Candidate, typename Ret, typename Any, typename... Args>
-    static void fill_vtable_entry(Ret(* &entry)(Any &, Args...)) {
+    static void fill_vtable_entry(Ret (*&entry)(Any &, Args...)) {
         if constexpr(std::is_invocable_r_v<Ret, decltype(Candidate), Args...>) {
             entry = +[](Any &, Args... args) -> Ret {
                 return std::invoke(Candidate, std::forward<Args>(args)...);
@@ -125,7 +121,6 @@ public:
     }
 };
 
-
 /**
  * @brief Poly base class used to inject functionalities into concepts.
  * @tparam Poly The outermost poly class.
@@ -141,7 +136,7 @@ struct poly_base {
      * @return The return value of the invoked function, if any.
      */
     template<auto Member, typename... Args>
-    [[nodiscard]] decltype(auto) invoke(const poly_base &self, Args &&... args) const {
+    [[nodiscard]] decltype(auto) invoke(const poly_base &self, Args &&...args) const {
         const auto &poly = static_cast<const Poly &>(self);
 
         if constexpr(std::is_function_v<std::remove_pointer_t<decltype(poly.vtable)>>) {
@@ -153,7 +148,7 @@ struct poly_base {
 
     /*! @copydoc invoke */
     template<auto Member, typename... Args>
-    [[nodiscard]] decltype(auto) invoke(poly_base &self, Args &&... args) {
+    [[nodiscard]] decltype(auto) invoke(poly_base &self, Args &&...args) {
         auto &poly = static_cast<Poly &>(self);
 
         if constexpr(std::is_function_v<std::remove_pointer_t<decltype(poly.vtable)>>) {
@@ -164,7 +159,6 @@ struct poly_base {
     }
 };
 
-
 /**
  * @brief Shortcut for calling `poly_base<Type>::invoke`.
  * @tparam Member Index of the function to invoke.
@@ -175,11 +169,10 @@ struct poly_base {
  * @return The return value of the invoked function, if any.
  */
 template<auto Member, typename Poly, typename... Args>
-decltype(auto) poly_call(Poly &&self, Args &&... args) {
+decltype(auto) poly_call(Poly &&self, Args &&...args) {
     return std::forward<Poly>(self).template invoke<Member>(self, std::forward<Args>(args)...);
 }
 
-
 /**
  * @brief Static polymorphism made simple and within everyone's reach.
  *
@@ -209,8 +202,7 @@ public:
     /*! @brief Default constructor. */
     basic_poly() ENTT_NOEXCEPT
         : storage{},
-          vtable{}
-    {}
+          vtable{} {}
 
     /**
      * @brief Constructs a poly by directly initializing the new object.
@@ -219,10 +211,9 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    explicit basic_poly(std::in_place_type_t<Type>, Args &&... args)
+    explicit basic_poly(std::in_place_type_t<Type>, Args &&...args)
         : storage{std::in_place_type<Type>, std::forward<Args>(args)...},
-          vtable{poly_vtable<Concept, Len, Align>::template instance<std::remove_const_t<std::remove_reference_t<Type>>>()}
-    {}
+          vtable{poly_vtable<Concept, Len, Align>::template instance<std::remove_const_t<std::remove_reference_t<Type>>>()} {}
 
     /**
      * @brief Constructs a poly from a given value.
@@ -231,8 +222,7 @@ public:
      */
     template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Type>>, basic_poly>>>
     basic_poly(Type &&value) ENTT_NOEXCEPT
-        : basic_poly{std::in_place_type<std::remove_cv_t<std::remove_reference_t<Type>>>, std::forward<Type>(value)}
-    {}
+        : basic_poly{std::in_place_type<std::remove_cv_t<std::remove_reference_t<Type>>>, std::forward<Type>(value)} {}
 
     /**
      * @brief Returns the object type if any, `type_id<void>()` otherwise.
@@ -246,12 +236,12 @@ public:
      * @brief Returns an opaque pointer to the contained instance.
      * @return An opaque pointer the contained instance, if any.
      */
-    [[nodiscard]] const void * data() const ENTT_NOEXCEPT {
+    [[nodiscard]] const void *data() const ENTT_NOEXCEPT {
         return storage.data();
     }
 
     /*! @copydoc data */
-    [[nodiscard]] void * data() ENTT_NOEXCEPT {
+    [[nodiscard]] void *data() ENTT_NOEXCEPT {
         return storage.data();
     }
 
@@ -262,7 +252,7 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    void emplace(Args &&... args) {
+    void emplace(Args &&...args) {
         storage.template emplace<Type>(std::forward<Args>(args)...);
         vtable = poly_vtable<Concept, Len, Align>::template instance<std::remove_const_t<std::remove_reference_t<Type>>>();
     }
@@ -285,12 +275,12 @@ public:
      * @brief Returns a pointer to the underlying concept.
      * @return A pointer to the underlying concept.
      */
-    [[nodiscard]] concept_type * operator->() ENTT_NOEXCEPT {
+    [[nodiscard]] concept_type *operator->() ENTT_NOEXCEPT {
         return this;
     }
 
     /*! @copydoc operator-> */
-    [[nodiscard]] const concept_type * operator->() const ENTT_NOEXCEPT {
+    [[nodiscard]] const concept_type *operator->() const ENTT_NOEXCEPT {
         return this;
     }
 
@@ -318,8 +308,6 @@ private:
     vtable_type vtable;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 14 - 22
src/entt/process/process.hpp

@@ -1,15 +1,12 @@
 #ifndef ENTT_PROCESS_PROCESS_HPP
 #define ENTT_PROCESS_PROCESS_HPP
 
-
-#include <utility>
 #include <type_traits>
+#include <utility>
 #include "../config/config.h"
 
-
 namespace entt {
 
-
 /**
  * @brief Base class for processes.
  *
@@ -71,7 +68,7 @@ namespace entt {
  */
 template<typename Derived, typename Delta>
 class process {
-    enum class state: unsigned int {
+    enum class state : unsigned int {
         UNINITIALIZED = 0,
         RUNNING,
         PAUSED,
@@ -84,31 +81,31 @@ class process {
 
     template<typename Target = Derived>
     auto next(std::integral_constant<state, state::UNINITIALIZED>)
-    -> decltype(std::declval<Target>().init(), void()) {
+        -> decltype(std::declval<Target>().init(), void()) {
         static_cast<Target *>(this)->init();
     }
 
     template<typename Target = Derived>
     auto next(std::integral_constant<state, state::RUNNING>, Delta delta, void *data)
-    -> decltype(std::declval<Target>().update(delta, data), void()) {
+        -> decltype(std::declval<Target>().update(delta, data), void()) {
         static_cast<Target *>(this)->update(delta, data);
     }
 
     template<typename Target = Derived>
     auto next(std::integral_constant<state, state::SUCCEEDED>)
-    -> decltype(std::declval<Target>().succeeded(), void()) {
+        -> decltype(std::declval<Target>().succeeded(), void()) {
         static_cast<Target *>(this)->succeeded();
     }
 
     template<typename Target = Derived>
     auto next(std::integral_constant<state, state::FAILED>)
-    -> decltype(std::declval<Target>().failed(), void()) {
+        -> decltype(std::declval<Target>().failed(), void()) {
         static_cast<Target *>(this)->failed();
     }
 
     template<typename Target = Derived>
     auto next(std::integral_constant<state, state::ABORTED>)
-    -> decltype(std::declval<Target>().aborted(), void()) {
+        -> decltype(std::declval<Target>().aborted(), void()) {
         static_cast<Target *>(this)->aborted();
     }
 
@@ -158,8 +155,8 @@ protected:
      * paused.
      */
     void unpause() ENTT_NOEXCEPT {
-        if(current  == state::PAUSED) {
-            current  = state::RUNNING;
+        if(current == state::PAUSED) {
+            current = state::RUNNING;
         }
     }
 
@@ -228,7 +225,7 @@ public:
      * @param data Optional data.
      */
     void tick(const Delta delta, void *data = nullptr) {
-        switch (current) {
+        switch(current) {
         case state::UNINITIALIZED:
             next(std::integral_constant<state, state::UNINITIALIZED>{});
             current = state::RUNNING;
@@ -265,7 +262,6 @@ private:
     state current{state::UNINITIALIZED};
 };
 
-
 /**
  * @brief Adaptor for lambdas and functors to turn them into processes.
  *
@@ -313,9 +309,8 @@ struct process_adaptor: process<process_adaptor<Func, Delta>, Delta>, private Fu
      * @param args Parameters to use to initialize the actual process.
      */
     template<typename... Args>
-    process_adaptor(Args &&... args)
-        : Func{std::forward<Args>(args)...}
-    {}
+    process_adaptor(Args &&...args)
+        : Func{std::forward<Args>(args)...} {}
 
     /**
      * @brief Updates a process and its internal state if required.
@@ -327,13 +322,10 @@ struct process_adaptor: process<process_adaptor<Func, Delta>, Delta>, private Fu
             delta,
             data,
             [this]() { this->succeed(); },
-            [this]() { this->fail(); }
-        );
+            [this]() { this->fail(); });
     }
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 10 - 16
src/entt/process/scheduler.hpp

@@ -1,19 +1,16 @@
 #ifndef ENTT_PROCESS_SCHEDULER_HPP
 #define ENTT_PROCESS_SCHEDULER_HPP
 
-
-#include <vector>
-#include <memory>
-#include <utility>
 #include <algorithm>
+#include <memory>
 #include <type_traits>
+#include <utility>
+#include <vector>
 #include "../config/config.h"
 #include "process.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Cooperative scheduler for processes.
  *
@@ -43,7 +40,7 @@ namespace entt {
 template<typename Delta>
 class scheduler {
     struct process_handler {
-        using instance_type = std::unique_ptr<void, void(*)(void *)>;
+        using instance_type = std::unique_ptr<void, void (*)(void *)>;
         using update_fn_type = bool(process_handler &, Delta, void *);
         using abort_fn_type = void(process_handler &, bool);
         using next_type = std::unique_ptr<process_handler>;
@@ -56,11 +53,10 @@ class scheduler {
 
     struct continuation {
         continuation(process_handler *ref)
-            : handler{ref}
-        {}
+            : handler{ref} {}
 
         template<typename Proc, typename... Args>
-        continuation then(Args &&... args) {
+        continuation then(Args &&...args) {
             static_assert(std::is_base_of_v<process<Proc, Delta>, Proc>, "Invalid process type");
             auto proc = typename process_handler::instance_type{new Proc{std::forward<Args>(args)...}, &scheduler::deleter<Proc>};
             handler->next.reset(new process_handler{std::move(proc), &scheduler::update<Proc>, &scheduler::abort<Proc>, nullptr});
@@ -118,7 +114,7 @@ public:
     scheduler(scheduler &&) = default;
 
     /*! @brief Default move assignment operator. @return This scheduler. */
-    scheduler & operator=(scheduler &&) = default;
+    scheduler &operator=(scheduler &&) = default;
 
     /**
      * @brief Number of processes currently scheduled.
@@ -172,7 +168,7 @@ public:
      * @return An opaque object to use to concatenate processes.
      */
     template<typename Proc, typename... Args>
-    auto attach(Args &&... args) {
+    auto attach(Args &&...args) {
         static_assert(std::is_base_of_v<process<Proc, Delta>, Proc>, "Invalid process type");
         auto proc = typename process_handler::instance_type{new Proc{std::forward<Args>(args)...}, &scheduler::deleter<Proc>};
         process_handler handler{std::move(proc), &scheduler::update<Proc>, &scheduler::abort<Proc>, nullptr};
@@ -253,7 +249,7 @@ public:
         auto sz = handlers.size();
 
         for(auto pos = handlers.size(); pos; --pos) {
-            auto &handler = handlers[pos-1];
+            auto &handler = handlers[pos - 1];
 
             if(const auto dead = handler.update(handler, delta, data); dead) {
                 std::swap(handler, handlers[--sz]);
@@ -289,8 +285,6 @@ private:
     std::vector<process_handler> handlers{};
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 7 - 12
src/entt/resource/cache.hpp

@@ -1,20 +1,17 @@
 #ifndef ENTT_RESOURCE_CACHE_HPP
 #define ENTT_RESOURCE_CACHE_HPP
 
-
 #include <type_traits>
 #include <unordered_map>
 #include <utility>
 #include "../config/config.h"
 #include "../core/fwd.hpp"
+#include "fwd.hpp"
 #include "handle.hpp"
 #include "loader.hpp"
-#include "fwd.hpp"
-
 
 namespace entt {
 
-
 /**
  * @brief Simple cache for resources of a given type.
  *
@@ -39,7 +36,7 @@ struct resource_cache {
     resource_cache(resource_cache &&) = default;
 
     /*! @brief Default move assignment operator. @return This cache. */
-    resource_cache & operator=(resource_cache &&) = default;
+    resource_cache &operator=(resource_cache &&) = default;
 
     /**
      * @brief Number of resources managed by a cache.
@@ -90,7 +87,7 @@ struct resource_cache {
      * @return A handle for the given resource.
      */
     template<typename Loader, typename... Args>
-    resource_handle<Resource> load(const id_type id, Args &&... args) {
+    resource_handle<Resource> load(const id_type id, Args &&...args) {
         if(auto it = resources.find(id); it == resources.cend()) {
             if(auto handle = temp<Loader>(std::forward<Args>(args)...); handle) {
                 return (resources[id] = std::move(handle));
@@ -126,7 +123,7 @@ struct resource_cache {
      * @return A handle for the given resource.
      */
     template<typename Loader, typename... Args>
-    resource_handle<Resource> reload(const id_type id, Args &&... args) {
+    resource_handle<Resource> reload(const id_type id, Args &&...args) {
         return (discard(id), load<Loader>(id, std::forward<Args>(args)...));
     }
 
@@ -143,7 +140,7 @@ struct resource_cache {
      * @return A handle for the given resource.
      */
     template<typename Loader, typename... Args>
-    [[nodiscard]] resource_handle<Resource> temp(Args &&... args) const {
+    [[nodiscard]] resource_handle<Resource> temp(Args &&...args) const {
         return Loader{}.get(std::forward<Args>(args)...);
     }
 
@@ -208,7 +205,7 @@ struct resource_cache {
      * @tparam Func Type of the function object to invoke.
      * @param func A valid function object.
      */
-    template <typename Func>
+    template<typename Func>
     void each(Func func) const {
         auto begin = resources.begin();
         auto end = resources.end();
@@ -230,8 +227,6 @@ private:
     std::unordered_map<id_type, resource_handle<Resource>> resources;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 7
src/entt/resource/fwd.hpp

@@ -1,23 +1,17 @@
 #ifndef ENTT_RESOURCE_FWD_HPP
 #define ENTT_RESOURCE_FWD_HPP
 
-
 namespace entt {
 
-
 template<typename>
 struct resource_cache;
 
-
 template<typename>
 class resource_handle;
 
-
 template<typename, typename>
 class resource_loader;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 14 - 22
src/entt/resource/handle.hpp

@@ -1,17 +1,14 @@
 #ifndef ENTT_RESOURCE_HANDLE_HPP
 #define ENTT_RESOURCE_HANDLE_HPP
 
-
 #include <memory>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Shared resource handle.
  *
@@ -42,8 +39,7 @@ public:
      * @param res A pointer to a properly initialized resource.
      */
     resource_handle(std::shared_ptr<Resource> res) ENTT_NOEXCEPT
-        : resource{std::move(res)}
-    {}
+        : resource{std::move(res)} {}
 
     /**
      * @brief Copy constructor.
@@ -64,8 +60,7 @@ public:
      */
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<Other, Resource> && std::is_base_of_v<Resource, Other>>>
     resource_handle(const resource_handle<Other> &other) ENTT_NOEXCEPT
-        : resource{other.resource}
-    {}
+        : resource{other.resource} {}
 
     /**
      * @brief Move constructs a handle which takes ownership of the resource.
@@ -74,22 +69,21 @@ public:
      */
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<Other, Resource> && std::is_base_of_v<Resource, Other>>>
     resource_handle(resource_handle<Other> &&other) ENTT_NOEXCEPT
-        : resource{std::move(other.resource)}
-    {}
+        : resource{std::move(other.resource)} {}
 
     /**
      * @brief Copy assignment operator.
      * @param other The instance to copy from.
      * @return This resource handle.
      */
-    resource_handle & operator=(const resource_handle<Resource> &other) ENTT_NOEXCEPT = default;
+    resource_handle &operator=(const resource_handle<Resource> &other) ENTT_NOEXCEPT = default;
 
     /**
      * @brief Move assignment operator.
      * @param other The instance to move from.
      * @return This resource handle.
      */
-    resource_handle & operator=(resource_handle<Resource> &&other) ENTT_NOEXCEPT = default;
+    resource_handle &operator=(resource_handle<Resource> &&other) ENTT_NOEXCEPT = default;
 
     /**
      * @brief Copy assignment operator from foreign handle.
@@ -125,33 +119,33 @@ public:
      *
      * @return A reference to the managed resource.
      */
-    [[nodiscard]] const Resource & get() const ENTT_NOEXCEPT {
+    [[nodiscard]] const Resource &get() const ENTT_NOEXCEPT {
         ENTT_ASSERT(static_cast<bool>(resource), "Invalid resource");
         return *resource;
     }
 
     /*! @copydoc get */
-    [[nodiscard]] Resource & get() ENTT_NOEXCEPT {
+    [[nodiscard]] Resource &get() ENTT_NOEXCEPT {
         return const_cast<Resource &>(std::as_const(*this).get());
     }
 
     /*! @copydoc get */
-    [[nodiscard]] operator const Resource & () const ENTT_NOEXCEPT {
+    [[nodiscard]] operator const Resource &() const ENTT_NOEXCEPT {
         return get();
     }
 
     /*! @copydoc get */
-    [[nodiscard]] operator Resource & () ENTT_NOEXCEPT {
+    [[nodiscard]] operator Resource &() ENTT_NOEXCEPT {
         return get();
     }
 
     /*! @copydoc get */
-    [[nodiscard]] const Resource & operator *() const ENTT_NOEXCEPT {
+    [[nodiscard]] const Resource &operator*() const ENTT_NOEXCEPT {
         return get();
     }
 
     /*! @copydoc get */
-    [[nodiscard]] Resource & operator *() ENTT_NOEXCEPT {
+    [[nodiscard]] Resource &operator*() ENTT_NOEXCEPT {
         return get();
     }
 
@@ -164,12 +158,12 @@ public:
      * @return A pointer to the managed resource or `nullptr` if the handle
      * contains no resource at all.
      */
-    [[nodiscard]] const Resource * operator->() const ENTT_NOEXCEPT {
+    [[nodiscard]] const Resource *operator->() const ENTT_NOEXCEPT {
         return resource.get();
     }
 
     /*! @copydoc operator-> */
-    [[nodiscard]] Resource * operator->() ENTT_NOEXCEPT {
+    [[nodiscard]] Resource *operator->() ENTT_NOEXCEPT {
         return const_cast<Resource *>(std::as_const(*this).operator->());
     }
 
@@ -193,8 +187,6 @@ private:
     std::shared_ptr<Resource> resource;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 2 - 7
src/entt/resource/loader.hpp

@@ -1,14 +1,11 @@
 #ifndef ENTT_RESOURCE_LOADER_HPP
 #define ENTT_RESOURCE_LOADER_HPP
 
-
 #include "fwd.hpp"
 #include "handle.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Base class for resource loaders.
  *
@@ -54,13 +51,11 @@ class resource_loader {
      * @return The resource just loaded or an empty pointer in case of errors.
      */
     template<typename... Args>
-    [[nodiscard]] resource_handle<Resource> get(Args &&... args) const {
+    [[nodiscard]] resource_handle<Resource> get(Args &&...args) const {
         return static_cast<const Loader *>(this)->load(std::forward<Args>(args)...);
     }
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 15 - 38
src/entt/signal/delegate.hpp

@@ -1,77 +1,61 @@
 #ifndef ENTT_SIGNAL_DELEGATE_HPP
 #define ENTT_SIGNAL_DELEGATE_HPP
 
-
-#include <tuple>
 #include <cstddef>
-#include <utility>
 #include <functional>
+#include <tuple>
 #include <type_traits>
-#include "../core/type_traits.hpp"
+#include <utility>
 #include "../config/config.h"
-
+#include "../core/type_traits.hpp"
 
 namespace entt {
 
-
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.
  */
 
-
 namespace internal {
 
-
 template<typename Ret, typename... Args>
-auto function_pointer(Ret(*)(Args...)) -> Ret(*)(Args...);
-
+auto function_pointer(Ret (*)(Args...)) -> Ret (*)(Args...);
 
 template<typename Ret, typename Type, typename... Args, typename Other>
-auto function_pointer(Ret(*)(Type, Args...), Other &&) -> Ret(*)(Args...);
-
+auto function_pointer(Ret (*)(Type, Args...), Other &&) -> Ret (*)(Args...);
 
 template<typename Class, typename Ret, typename... Args, typename... Other>
-auto function_pointer(Ret(Class:: *)(Args...), Other &&...) -> Ret(*)(Args...);
-
+auto function_pointer(Ret (Class::*)(Args...), Other &&...) -> Ret (*)(Args...);
 
 template<typename Class, typename Ret, typename... Args, typename... Other>
-auto function_pointer(Ret(Class:: *)(Args...) const, Other &&...) -> Ret(*)(Args...);
-
+auto function_pointer(Ret (Class::*)(Args...) const, Other &&...) -> Ret (*)(Args...);
 
 template<typename Class, typename Type, typename... Other>
-auto function_pointer(Type Class:: *, Other &&...) -> Type(*)();
-
+auto function_pointer(Type Class::*, Other &&...) -> Type (*)();
 
 template<typename... Type>
 using function_pointer_t = decltype(internal::function_pointer(std::declval<Type>()...));
 
-
 template<typename... Class, typename Ret, typename... Args>
-[[nodiscard]] constexpr auto index_sequence_for(Ret(*)(Args...)) {
+[[nodiscard]] constexpr auto index_sequence_for(Ret (*)(Args...)) {
     return std::index_sequence_for<Class..., Args...>{};
 }
 
-
-}
-
+} // namespace internal
 
 /**
  * Internal details not to be documented.
  * @endcond
  */
 
-
 /*! @brief Used to wrap a function or a member of a specified type. */
 template<auto>
 struct connect_arg_t {};
 
-
 /*! @brief Constant of type connect_arg_t used to disambiguate calls. */
 template<auto Func>
 inline constexpr connect_arg_t<Func> connect_arg{};
 
-
 /**
  * @brief Basic delegate implementation.
  *
@@ -81,7 +65,6 @@ inline constexpr connect_arg_t<Func> connect_arg{};
 template<typename>
 class delegate;
 
-
 /**
  * @brief Utility class to use to send around functions and members.
  *
@@ -132,8 +115,8 @@ public:
 
     /*! @brief Default constructor. */
     delegate() ENTT_NOEXCEPT
-        : fn{nullptr}, data{nullptr}
-    {}
+        : fn{nullptr},
+          data{nullptr} {}
 
     /**
      * @brief Constructs a delegate and connects a free function or an unbound
@@ -271,7 +254,7 @@ public:
      * @brief Returns the instance or the payload linked to a delegate, if any.
      * @return An opaque pointer to the underlying data.
      */
-    [[nodiscard]] const void * instance() const ENTT_NOEXCEPT {
+    [[nodiscard]] const void *instance() const ENTT_NOEXCEPT {
         return data;
     }
 
@@ -315,7 +298,6 @@ private:
     const void *data;
 };
 
-
 /**
  * @brief Compares the contents of two delegates.
  * @tparam Ret Return type of a function type.
@@ -329,7 +311,6 @@ template<typename Ret, typename... Args>
     return !(lhs == rhs);
 }
 
-
 /**
  * @brief Deduction guide.
  * @tparam Candidate Function or member to connect to the delegate.
@@ -337,7 +318,6 @@ template<typename Ret, typename... Args>
 template<auto Candidate>
 delegate(connect_arg_t<Candidate>) -> delegate<std::remove_pointer_t<internal::function_pointer_t<decltype(Candidate)>>>;
 
-
 /**
  * @brief Deduction guide.
  * @tparam Candidate Function or member to connect to the delegate.
@@ -346,17 +326,14 @@ delegate(connect_arg_t<Candidate>) -> delegate<std::remove_pointer_t<internal::f
 template<auto Candidate, typename Type>
 delegate(connect_arg_t<Candidate>, Type &&) -> delegate<std::remove_pointer_t<internal::function_pointer_t<decltype(Candidate), Type>>>;
 
-
 /**
  * @brief Deduction guide.
  * @tparam Ret Return type of a function 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...)>;
 
+} // namespace entt
 
 #endif

+ 10 - 15
src/entt/signal/dispatcher.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_SIGNAL_DISPATCHER_HPP
 #define ENTT_SIGNAL_DISPATCHER_HPP
 
-
 #include <cstddef>
 #include <memory>
 #include <type_traits>
@@ -12,10 +11,8 @@
 #include "../core/type_info.hpp"
 #include "sigh.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Basic dispatcher implementation.
  *
@@ -50,7 +47,7 @@ class dispatcher {
                 signal.publish(events[pos]);
             }
 
-            events.erase(events.cbegin(), events.cbegin()+length);
+            events.erase(events.cbegin(), events.cbegin() + length);
         }
 
         void disconnect(void *instance) override {
@@ -66,13 +63,13 @@ class dispatcher {
         }
 
         template<typename... Args>
-        void trigger(Args &&... args) {
+        void trigger(Args &&...args) {
             Event instance{std::forward<Args>(args)...};
             signal.publish(instance);
         }
 
         template<typename... Args>
-        void enqueue(Args &&... args) {
+        void enqueue(Args &&...args) {
             if constexpr(std::is_aggregate_v<Event>) {
                 events.push_back(Event{std::forward<Args>(args)...});
             } else {
@@ -86,11 +83,11 @@ class dispatcher {
     };
 
     template<typename Event>
-    [[nodiscard]] pool_handler<Event> & assure() {
+    [[nodiscard]] pool_handler<Event> &assure() {
         const auto index = type_index<Event>::value();
 
         if(!(index < pools.size())) {
-            pools.resize(std::size_t(index)+1u);
+            pools.resize(std::size_t(index) + 1u);
         }
 
         if(!pools[index]) {
@@ -108,7 +105,7 @@ public:
     dispatcher(dispatcher &&) = default;
 
     /*! @brief Default move assignment operator. @return This dispatcher. */
-    dispatcher & operator=(dispatcher &&) = default;
+    dispatcher &operator=(dispatcher &&) = default;
 
     /**
      * @brief Returns a sink object for the given event.
@@ -143,7 +140,7 @@ public:
      * @param args Arguments to use to construct the event.
      */
     template<typename Event, typename... Args>
-    void trigger(Args &&... args) {
+    void trigger(Args &&...args) {
         assure<Event>().trigger(std::forward<Args>(args)...);
     }
 
@@ -172,7 +169,7 @@ public:
      * @param args Arguments to use to construct the event.
      */
     template<typename Event, typename... Args>
-    void enqueue(Args &&... args) {
+    void enqueue(Args &&...args) {
         assure<Event>().enqueue(std::forward<Args>(args)...);
     }
 
@@ -260,7 +257,7 @@ public:
      */
     void update() const {
         for(auto pos = pools.size(); pos; --pos) {
-            if(auto &&cpool = pools[pos-1]; cpool) {
+            if(auto &&cpool = pools[pos - 1]; cpool) {
                 cpool->publish();
             }
         }
@@ -270,8 +267,6 @@ private:
     std::vector<std::unique_ptr<basic_pool>> pools;
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 8 - 14
src/entt/signal/emitter.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_SIGNAL_EMITTER_HPP
 #define ENTT_SIGNAL_EMITTER_HPP
 
-
 #include <algorithm>
 #include <functional>
 #include <iterator>
@@ -14,10 +13,8 @@
 #include "../core/fwd.hpp"
 #include "../core/type_info.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief General purpose event emitter.
  *
@@ -60,7 +57,7 @@ class emitter {
             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);
+                   && std::all_of(on_list.cbegin(), on_list.cend(), pred);
         }
 
         void clear() ENTT_NOEXCEPT override {
@@ -122,11 +119,11 @@ class emitter {
     };
 
     template<typename Event>
-    [[nodiscard]] pool_handler<Event> * assure() {
+    [[nodiscard]] pool_handler<Event> *assure() {
         const auto index = type_index<Event>::value();
 
         if(!(index < pools.size())) {
-            pools.resize(std::size_t(index)+1u);
+            pools.resize(std::size_t(index) + 1u);
         }
 
         if(!pools[index]) {
@@ -137,7 +134,7 @@ class emitter {
     }
 
     template<typename Event>
-    [[nodiscard]] const pool_handler<Event> * assure() const {
+    [[nodiscard]] const pool_handler<Event> *assure() const {
         const auto index = type_index<Event>::value();
         return (!(index < pools.size()) || !pools[index]) ? nullptr : static_cast<const pool_handler<Event> *>(pools[index].get());
     }
@@ -169,8 +166,7 @@ public:
          * @param conn A connection object to wrap.
          */
         connection(typename pool_handler<Event>::connection_type conn)
-            : pool_handler<Event>::connection_type{std::move(conn)}
-        {}
+            : pool_handler<Event>::connection_type{std::move(conn)} {}
     };
 
     /*! @brief Default constructor. */
@@ -185,7 +181,7 @@ public:
     emitter(emitter &&) = default;
 
     /*! @brief Default move assignment operator. @return This emitter. */
-    emitter & operator=(emitter &&) = default;
+    emitter &operator=(emitter &&) = default;
 
     /**
      * @brief Emits the given event.
@@ -199,7 +195,7 @@ public:
      * @param args Parameters to use to initialize the event.
      */
     template<typename Event, typename... Args>
-    void publish(Args &&... args) {
+    void publish(Args &&...args) {
         Event instance{std::forward<Args>(args)...};
         assure<Event>()->publish(instance, *static_cast<Derived *>(this));
     }
@@ -320,8 +316,6 @@ private:
     std::vector<std::unique_ptr<basic_pool>> pools{};
 };
 
-
-}
-
+} // namespace entt
 
 #endif

+ 1 - 11
src/entt/signal/fwd.hpp

@@ -1,36 +1,26 @@
 #ifndef ENTT_SIGNAL_FWD_HPP
 #define ENTT_SIGNAL_FWD_HPP
 
-
 namespace entt {
 
-
 template<typename>
 class delegate;
 
-
 class dispatcher;
 
-
 template<typename>
 class emitter;
 
-
 class connection;
 
-
 struct scoped_connection;
 
-
 template<typename>
 class sink;
 
-
 template<typename>
 class sigh;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 13 - 28
src/entt/signal/sigh.hpp

@@ -1,21 +1,18 @@
 #ifndef ENTT_SIGNAL_SIGH_HPP
 #define ENTT_SIGNAL_SIGH_HPP
 
-
-#include <vector>
-#include <utility>
-#include <iterator>
 #include <algorithm>
 #include <functional>
+#include <iterator>
 #include <type_traits>
+#include <utility>
+#include <vector>
 #include "../config/config.h"
 #include "delegate.hpp"
 #include "fwd.hpp"
 
-
 namespace entt {
 
-
 /**
  * @brief Sink class.
  *
@@ -27,7 +24,6 @@ namespace entt {
 template<typename Function>
 class sink;
 
-
 /**
  * @brief Unmanaged signal handler.
  *
@@ -39,7 +35,6 @@ class sink;
 template<typename Function>
 class sigh;
 
-
 /**
  * @brief Unmanaged signal handler.
  *
@@ -141,7 +136,6 @@ private:
     std::vector<delegate<Ret(Args...)>> calls;
 };
 
-
 /**
  * @brief Connection class.
  *
@@ -155,8 +149,7 @@ class connection {
     friend class sink;
 
     connection(delegate<void(void *)> fn, void *ref)
-        : disconnect{fn}, signal{ref}
-    {}
+        : disconnect{fn}, signal{ref} {}
 
 public:
     /*! @brief Default constructor. */
@@ -183,7 +176,6 @@ private:
     void *signal{};
 };
 
-
 /**
  * @brief Scoped connection class.
  *
@@ -202,8 +194,7 @@ struct scoped_connection {
      * @param other A valid connection object.
      */
     scoped_connection(const connection &other)
-        : conn{other}
-    {}
+        : conn{other} {}
 
     /*! @brief Default copy constructor, deleted on purpose. */
     scoped_connection(const scoped_connection &) = delete;
@@ -213,8 +204,7 @@ struct scoped_connection {
      * @param other The scoped connection to move from.
      */
     scoped_connection(scoped_connection &&other) ENTT_NOEXCEPT
-        : conn{std::exchange(other.conn, {})}
-    {}
+        : conn{std::exchange(other.conn, {})} {}
 
     /*! @brief Automatically breaks the link on destruction. */
     ~scoped_connection() {
@@ -225,14 +215,14 @@ struct scoped_connection {
      * @brief Default copy assignment operator, deleted on purpose.
      * @return This scoped connection.
      */
-    scoped_connection & operator=(const scoped_connection &) = delete;
+    scoped_connection &operator=(const scoped_connection &) = delete;
 
     /**
      * @brief Move assignment operator.
      * @param other The scoped connection to move from.
      * @return This scoped connection.
      */
-    scoped_connection & operator=(scoped_connection &&other) ENTT_NOEXCEPT {
+    scoped_connection &operator=(scoped_connection &&other) ENTT_NOEXCEPT {
         conn = std::exchange(other.conn, {});
         return *this;
     }
@@ -242,7 +232,7 @@ struct scoped_connection {
      * @param other The connection object to acquire.
      * @return This scoped connection.
      */
-    scoped_connection & operator=(connection other) {
+    scoped_connection &operator=(connection other) {
         conn = std::move(other);
         return *this;
     }
@@ -264,7 +254,6 @@ private:
     connection conn;
 };
 
-
 /**
  * @brief Sink class.
  *
@@ -305,8 +294,7 @@ public:
      */
     sink(sigh<Ret(Args...)> &ref) ENTT_NOEXCEPT
         : offset{},
-          signal{&ref}
-    {}
+          signal{&ref} {}
 
     /**
      * @brief Returns false if at least a listener is connected to the sink.
@@ -420,7 +408,7 @@ public:
 
         delegate<void(void *)> conn{};
         conn.template connect<&release<Candidate>>();
-        return { std::move(conn), signal };
+        return {std::move(conn), signal};
     }
 
     /**
@@ -450,7 +438,7 @@ public:
 
         delegate<void(void *)> conn{};
         conn.template connect<&release<Candidate, Type>>(value_or_instance);
-        return { std::move(conn), signal };
+        return {std::move(conn), signal};
     }
 
     /**
@@ -516,7 +504,6 @@ private:
     signal_type *signal;
 };
 
-
 /**
  * @brief Deduction guide.
  *
@@ -529,8 +516,6 @@ private:
 template<typename Ret, typename... Args>
 sink(sigh<Ret(Args...)> &) -> sink<Ret(Args...)>;
 
-
-}
-
+} // namespace entt
 
 #endif

+ 39 - 47
test/benchmark/benchmark.cpp

@@ -1,7 +1,7 @@
-#include <iostream>
+#include <chrono>
 #include <cstddef>
 #include <cstdint>
-#include <chrono>
+#include <iostream>
 #include <iterator>
 #include <gtest/gtest.h>
 #include <entt/core/type_info.hpp>
@@ -24,7 +24,8 @@ struct entt::component_traits<stable_position>: basic_component_traits {
 };
 
 struct timer final {
-    timer(): start{std::chrono::system_clock::now()} {}
+    timer()
+        : start{std::chrono::system_clock::now()} {}
 
     void elapsed() {
         auto now = std::chrono::system_clock::now();
@@ -62,7 +63,7 @@ void pathological(Func func) {
         }
     }
 
-    func(registry, [](auto &... comp) {
+    func(registry, [](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -304,7 +305,7 @@ TEST(Benchmark, IterateSingleComponent1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -325,7 +326,7 @@ TEST(Benchmark, IterateSingleComponentTombstonePolicy1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -341,7 +342,7 @@ TEST(Benchmark, IterateSingleComponentRuntime1M) {
     }
 
     auto test = [&](auto func) {
-        entt::id_type types[] = { entt::type_hash<position>::value() };
+        entt::id_type types[] = {entt::type_hash<position>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -370,7 +371,7 @@ TEST(Benchmark, IterateTwoComponents1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -392,7 +393,7 @@ TEST(Benchmark, IterateTombstonePolicyTwoComponentsTombstonePolicy1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -417,7 +418,7 @@ TEST(Benchmark, IterateTwoComponents1MHalf) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -442,7 +443,7 @@ TEST(Benchmark, IterateTwoComponents1MOne) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -465,7 +466,7 @@ TEST(Benchmark, IterateTwoComponentsNonOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -488,7 +489,7 @@ TEST(Benchmark, IterateTwoComponentsFullOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -511,7 +512,7 @@ TEST(Benchmark, IterateTwoComponentsPartialOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -530,8 +531,7 @@ TEST(Benchmark, IterateTwoComponentsRuntime1M) {
     auto test = [&](auto func) {
         entt::id_type types[] = {
             entt::type_hash<position>::value(),
-            entt::type_hash<velocity>::value()
-        };
+            entt::type_hash<velocity>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -561,8 +561,7 @@ TEST(Benchmark, IterateTwoComponentsRuntime1MHalf) {
     auto test = [&](auto func) {
         entt::id_type types[] = {
             entt::type_hash<position>::value(),
-            entt::type_hash<velocity>::value()
-        };
+            entt::type_hash<velocity>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -592,8 +591,7 @@ TEST(Benchmark, IterateTwoComponentsRuntime1MOne) {
     auto test = [&](auto func) {
         entt::id_type types[] = {
             entt::type_hash<position>::value(),
-            entt::type_hash<velocity>::value()
-        };
+            entt::type_hash<velocity>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -624,7 +622,7 @@ TEST(Benchmark, IterateThreeComponents1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -647,7 +645,7 @@ TEST(Benchmark, IterateThreeComponentsTombstonePolicy1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -673,7 +671,7 @@ TEST(Benchmark, IterateThreeComponents1MHalf) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -699,7 +697,7 @@ TEST(Benchmark, IterateThreeComponents1MOne) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -723,7 +721,7 @@ TEST(Benchmark, IterateThreeComponentsNonOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -747,7 +745,7 @@ TEST(Benchmark, IterateThreeComponentsFullOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -771,7 +769,7 @@ TEST(Benchmark, IterateThreeComponentsPartialOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -792,8 +790,7 @@ TEST(Benchmark, IterateThreeComponentsRuntime1M) {
         entt::id_type types[] = {
             entt::type_hash<position>::value(),
             entt::type_hash<velocity>::value(),
-            entt::type_hash<comp<0>>::value()
-        };
+            entt::type_hash<comp<0>>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -826,8 +823,7 @@ TEST(Benchmark, IterateThreeComponentsRuntime1MHalf) {
         entt::id_type types[] = {
             entt::type_hash<position>::value(),
             entt::type_hash<velocity>::value(),
-            entt::type_hash<comp<0>>::value()
-        };
+            entt::type_hash<comp<0>>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -860,8 +856,7 @@ TEST(Benchmark, IterateThreeComponentsRuntime1MOne) {
         entt::id_type types[] = {
             entt::type_hash<position>::value(),
             entt::type_hash<velocity>::value(),
-            entt::type_hash<comp<0>>::value()
-        };
+            entt::type_hash<comp<0>>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -895,7 +890,7 @@ TEST(Benchmark, IterateFiveComponents1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -920,7 +915,7 @@ TEST(Benchmark, IterateFiveComponentsTombstonePolicy1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -948,7 +943,7 @@ TEST(Benchmark, IterateFiveComponents1MHalf) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -976,7 +971,7 @@ TEST(Benchmark, IterateFiveComponents1MOne) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -1002,7 +997,7 @@ TEST(Benchmark, IterateFiveComponentsNonOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -1028,7 +1023,7 @@ TEST(Benchmark, IterateFiveComponentsFullOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -1054,7 +1049,7 @@ TEST(Benchmark, IterateFiveComponentsPartialFourOfFiveOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -1080,7 +1075,7 @@ TEST(Benchmark, IterateFiveComponentsPartialThreeOfFiveOwningGroup1M) {
         timer.elapsed();
     };
 
-    test([](auto &... comp) {
+    test([](auto &...comp) {
         ((comp.x = {}), ...);
     });
 }
@@ -1105,8 +1100,7 @@ TEST(Benchmark, IterateFiveComponentsRuntime1M) {
             entt::type_hash<velocity>::value(),
             entt::type_hash<comp<0>>::value(),
             entt::type_hash<comp<1>>::value(),
-            entt::type_hash<comp<2>>::value()
-        };
+            entt::type_hash<comp<2>>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -1145,8 +1139,7 @@ TEST(Benchmark, IterateFiveComponentsRuntime1MHalf) {
             entt::type_hash<velocity>::value(),
             entt::type_hash<comp<0>>::value(),
             entt::type_hash<comp<1>>::value(),
-            entt::type_hash<comp<2>>::value()
-        };
+            entt::type_hash<comp<2>>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);
@@ -1185,8 +1178,7 @@ TEST(Benchmark, IterateFiveComponentsRuntime1MOne) {
             entt::type_hash<velocity>::value(),
             entt::type_hash<comp<0>>::value(),
             entt::type_hash<comp<1>>::value(),
-            entt::type_hash<comp<2>>::value()
-        };
+            entt::type_hash<comp<2>>::value()};
 
         timer timer;
         registry.runtime_view(std::begin(types), std::end(types)).each(func);

+ 6 - 6
test/entt/core/algorithm.cpp

@@ -14,7 +14,7 @@ TEST(Algorithm, StdSort) {
     sort(arr.begin(), arr.end());
 
     for(auto i = 0u; i < (arr.size() - 1u); ++i) {
-        ASSERT_LT(arr[i], arr[i+1u]);
+        ASSERT_LT(arr[i], arr[i + 1u]);
     }
 }
 
@@ -28,7 +28,7 @@ TEST(Algorithm, StdSortBoxedInt) {
     });
 
     for(auto i = 0u; i < (arr.size() - 1u); ++i) {
-        ASSERT_GT(arr[i].value, arr[i+1u].value);
+        ASSERT_GT(arr[i].value, arr[i + 1u].value);
     }
 }
 
@@ -39,7 +39,7 @@ TEST(Algorithm, InsertionSort) {
     sort(arr.begin(), arr.end());
 
     for(auto i = 0u; i < (arr.size() - 1u); ++i) {
-        ASSERT_LT(arr[i], arr[i+1u]);
+        ASSERT_LT(arr[i], arr[i + 1u]);
     }
 }
 
@@ -52,7 +52,7 @@ TEST(Algorithm, InsertionSortBoxedInt) {
     });
 
     for(auto i = 0u; i < (arr.size() - 1u); ++i) {
-        ASSERT_GT(arr[i].value, arr[i+1u].value);
+        ASSERT_GT(arr[i].value, arr[i + 1u].value);
     }
 }
 
@@ -72,7 +72,7 @@ TEST(Algorithm, RadixSort) {
     });
 
     for(auto i = 0u; i < (arr.size() - 1u); ++i) {
-        ASSERT_LT(arr[i], arr[i+1u]);
+        ASSERT_LT(arr[i], arr[i + 1u]);
     }
 }
 
@@ -85,7 +85,7 @@ TEST(Algorithm, RadixSortBoxedInt) {
     });
 
     for(auto i = 0u; i < (arr.size() - 1u); ++i) {
-        ASSERT_GT(arr[i].value, arr[i+1u].value);
+        ASSERT_GT(arr[i].value, arr[i + 1u].value);
     }
 }
 

+ 20 - 11
test/entt/core/any.cpp

@@ -7,17 +7,20 @@
 #include <entt/core/any.hpp>
 
 struct empty {
-    ~empty() { ++counter; }
+    ~empty() {
+        ++counter;
+    }
 
     inline static int counter = 0;
 };
 
 struct fat {
     fat(double v1, double v2, double v3, double v4)
-        : value{v1, v2, v3, v4}
-    {}
+        : value{v1, v2, v3, v4} {}
 
-    ~fat() { ++counter; }
+    ~fat() {
+        ++counter;
+    }
 
     bool operator==(const fat &other) const {
         return std::equal(std::begin(value), std::end(value), std::begin(other.value), std::end(other.value));
@@ -33,11 +36,15 @@ struct not_comparable {
 
 template<auto Sz>
 struct not_copyable {
-    not_copyable(): payload{} {}
+    not_copyable()
+        : payload{} {}
+
     not_copyable(const not_copyable &) = delete;
     not_copyable(not_copyable &&) = default;
-    not_copyable & operator=(const not_copyable &) = delete;
-    not_copyable & operator=(not_copyable &&) = default;
+
+    not_copyable &operator=(const not_copyable &) = delete;
+    not_copyable &operator=(not_copyable &&) = default;
+
     double payload[Sz];
 };
 
@@ -560,7 +567,7 @@ TEST_F(Any, EmplaceVoid) {
     ASSERT_FALSE(any);
     ASSERT_TRUE(any.owner());
     ASSERT_EQ(any.type(), entt::type_id<void>());
- }
+}
 
 TEST_F(Any, Reset) {
     entt::any any{42};
@@ -1136,15 +1143,17 @@ TEST_F(Any, Alignment) {
         cb(data, target[1].data());
     };
 
-    entt::basic_any<alignment> nosbo[2] = { over_aligned{}, over_aligned{} };
+    entt::basic_any<alignment> nosbo[2] = {over_aligned{}, over_aligned{}};
     test(nosbo, [](auto *pre, auto *post) { ASSERT_EQ(pre, post); });
 
-    entt::basic_any<alignment, alignment> sbo[2] = { over_aligned{}, over_aligned{} };
+    entt::basic_any<alignment, alignment> sbo[2] = {over_aligned{}, over_aligned{}};
     test(sbo, [](auto *pre, auto *post) { ASSERT_NE(pre, post); });
 }
 
 TEST_F(Any, AggregatesMustWork) {
-    struct aggregate_type { int value; };
+    struct aggregate_type {
+        int value;
+    };
 
     // the goal of this test is to enforce the requirements for aggregate types
     entt::any{std::in_place_type<aggregate_type>, 42}.emplace<aggregate_type>(42);

+ 12 - 8
test/entt/core/compressed_pair.cpp

@@ -7,20 +7,23 @@
 struct empty_type {};
 
 struct move_only_type {
-    move_only_type(): value{new int{99}} {}
+    move_only_type()
+        : value{new int{99}} {}
 
-    move_only_type(int v): value{new int{v}} {}
+    move_only_type(int v)
+        : value{new int{v}} {}
 
-    ~move_only_type() { delete value; }
+    ~move_only_type() {
+        delete value;
+    }
 
     move_only_type(const move_only_type &) = delete;
-    move_only_type & operator=(const move_only_type &) = delete;
+    move_only_type &operator=(const move_only_type &) = delete;
 
     move_only_type(move_only_type &&other) ENTT_NOEXCEPT
-        : value{std::exchange(other.value, nullptr)}
-    {}
+        : value{std::exchange(other.value, nullptr)} {}
 
-    move_only_type & operator=(move_only_type &&other) ENTT_NOEXCEPT {
+    move_only_type &operator=(move_only_type &&other) ENTT_NOEXCEPT {
         delete value;
         value = std::exchange(other.value, nullptr);
         return *this;
@@ -30,7 +33,8 @@ struct move_only_type {
 };
 
 struct non_default_constructible {
-    non_default_constructible(int v): value{v} {}
+    non_default_constructible(int v)
+        : value{v} {}
 
     int value;
 };

+ 1 - 2
test/entt/core/enum.cpp

@@ -17,8 +17,7 @@ enum class registered {
 
 template<>
 struct entt::enum_as_bitmask<registered>
-    : std::true_type
-{};
+    : std::true_type {};
 
 TEST(Enum, Functionalities) {
     auto test = [](auto identity) {

+ 1 - 1
test/entt/core/memory.cpp

@@ -9,7 +9,7 @@ struct test_allocator: std::allocator<int> {
 
     using std::allocator<int>::allocator;
 
-    test_allocator & operator=(const test_allocator &other) {
+    test_allocator &operator=(const test_allocator &other) {
         // necessary to avoid call suppression
         base::operator=(other);
         return *this;

+ 15 - 15
test/entt/core/tuple.cpp

@@ -3,23 +3,23 @@
 #include <entt/core/tuple.hpp>
 
 TEST(Tuple, UnwrapTuple) {
-	auto single = std::make_tuple(42);
-	auto multi = std::make_tuple(42, 'c');
-	auto ref = std::forward_as_tuple(std::get<0>(single));
+    auto single = std::make_tuple(42);
+    auto multi = std::make_tuple(42, 'c');
+    auto ref = std::forward_as_tuple(std::get<0>(single));
 
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(single)), int &>));
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(multi)), std::tuple<int, char> &>));
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(ref)), int &>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(single)), int &>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(multi)), std::tuple<int, char> &>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(ref)), int &>));
 
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::move(single))), int &&>));
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::move(multi))), std::tuple<int, char> &&>));
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::move(ref))), int &>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::move(single))), int &&>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::move(multi))), std::tuple<int, char> &&>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::move(ref))), int &>));
 
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::as_const(single))), const int &>));
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::as_const(multi))), const std::tuple<int, char> &>));
-	ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::as_const(ref))), int &>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::as_const(single))), const int &>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::as_const(multi))), const std::tuple<int, char> &>));
+    ASSERT_TRUE((std::is_same_v<decltype(entt::unwrap_tuple(std::as_const(ref))), int &>));
 
-	ASSERT_EQ(entt::unwrap_tuple(single), 42);
-	ASSERT_EQ(entt::unwrap_tuple(multi), multi);
-	ASSERT_EQ(entt::unwrap_tuple(std::move(ref)), 42);
+    ASSERT_EQ(entt::unwrap_tuple(single), 42);
+    ASSERT_EQ(entt::unwrap_tuple(multi), multi);
+    ASSERT_EQ(entt::unwrap_tuple(std::move(ref)), 42);
 }

+ 3 - 3
test/entt/core/type_info.cpp

@@ -32,11 +32,11 @@ TEST(TypeName, Functionalities) {
     ASSERT_EQ(entt::type_name<float>{}.value(), std::string_view{""});
 
     ASSERT_TRUE((entt::type_name<entt::integral_constant<3>>::value() == std::string_view{"std::integral_constant<int, 3>"})
-        || (entt::type_name<entt::integral_constant<3>>::value() == std::string_view{"std::__1::integral_constant<int, 3>"})
-        || (entt::type_name<entt::integral_constant<3>>::value() == std::string_view{"struct std::integral_constant<int,3>"}));
+                || (entt::type_name<entt::integral_constant<3>>::value() == std::string_view{"std::__1::integral_constant<int, 3>"})
+                || (entt::type_name<entt::integral_constant<3>>::value() == std::string_view{"struct std::integral_constant<int,3>"}));
 
     ASSERT_TRUE(((entt::type_name<entt::type_list<entt::type_list<int, char>, double>>::value()) == std::string_view{"entt::type_list<entt::type_list<int, char>, double>"})
-        || ((entt::type_name<entt::type_list<entt::type_list<int, char>, double>>::value()) == std::string_view{"struct entt::type_list<struct entt::type_list<int,char>,double>"}));
+                || ((entt::type_name<entt::type_list<entt::type_list<int, char>, double>>::value()) == std::string_view{"struct entt::type_list<struct entt::type_list<int,char>,double>"}));
 
     ASSERT_EQ(static_cast<std::string_view>(entt::type_name<int>{}), entt::type_name<int>::value());
 }

+ 9 - 3
test/entt/core/type_traits.cpp

@@ -15,7 +15,9 @@ struct not_comparable {
 struct nlohmann_json_like {
     using value_type = nlohmann_json_like;
 
-    bool operator==(const nlohmann_json_like &) const { return true; }
+    bool operator==(const nlohmann_json_like &) const {
+        return true;
+    }
 };
 
 TEST(TypeTraits, SizeOf) {
@@ -160,9 +162,13 @@ TEST(TypeTraits, ConstnessAs) {
 
 TEST(TypeTraits, MemberClass) {
     struct clazz {
-        char foo(int) { return {}; }
+        char foo(int) {
+            return {};
+        }
 
-        int bar(double, float) const { return {}; }
+        int bar(double, float) const {
+            return {};
+        }
 
         bool quux;
     };

+ 8 - 9
test/entt/core/utility.cpp

@@ -19,11 +19,11 @@ TEST(Utility, Identity) {
 }
 
 TEST(Utility, Overload) {
-    ASSERT_EQ(entt::overload<void(int)>(&functions::foo), static_cast<void(*)(int)>(&functions::foo));
-    ASSERT_EQ(entt::overload<void()>(&functions::foo), static_cast<void(*)()>(&functions::foo));
+    ASSERT_EQ(entt::overload<void(int)>(&functions::foo), static_cast<void (*)(int)>(&functions::foo));
+    ASSERT_EQ(entt::overload<void()>(&functions::foo), static_cast<void (*)()>(&functions::foo));
 
-    ASSERT_EQ(entt::overload<void(int)>(&functions::bar), static_cast<void(functions:: *)(int)>(&functions::bar));
-    ASSERT_EQ(entt::overload<void()>(&functions::bar), static_cast<void(functions:: *)()>(&functions::bar));
+    ASSERT_EQ(entt::overload<void(int)>(&functions::bar), static_cast<void (functions::*)(int)>(&functions::bar));
+    ASSERT_EQ(entt::overload<void()>(&functions::bar), static_cast<void (functions::*)()>(&functions::bar));
 
     functions instance;
 
@@ -40,8 +40,7 @@ TEST(Utility, Overloaded) {
 
     entt::overloaded func{
         [&iv](int value) { iv = value; },
-        [&cv](char value) { cv = value; }
-    };
+        [&cv](char value) { cv = value; }};
 
     func(42);
     func('c');
@@ -52,9 +51,9 @@ TEST(Utility, Overloaded) {
 
 TEST(Utility, YCombinator) {
     entt::y_combinator gauss([](const auto &self, auto value) -> unsigned int {
-        return value ? (value + self(value-1u)) : 0;
+        return value ? (value + self(value - 1u)) : 0;
     });
 
-    ASSERT_EQ(gauss(3u), 3u*4u/2u);
-    ASSERT_EQ(std::as_const(gauss)(7u), 7u*8u/2u);
+    ASSERT_EQ(gauss(3u), 3u * 4u / 2u);
+    ASSERT_EQ(std::as_const(gauss)(7u), 7u * 8u / 2u);
 }

+ 6 - 4
test/entt/entity/group.cpp

@@ -3,12 +3,14 @@
 #include <type_traits>
 #include <utility>
 #include <gtest/gtest.h>
-#include <entt/entity/registry.hpp>
 #include <entt/entity/group.hpp>
+#include <entt/entity/registry.hpp>
 
 struct empty_type {};
 
-struct boxed_int { int value; };
+struct boxed_int {
+    int value;
+};
 
 bool operator==(const boxed_int &lhs, const boxed_int &rhs) {
     return lhs.value == rhs.value;
@@ -286,7 +288,7 @@ TEST(NonOwningGroup, SortAsAPool) {
     registry.emplace<unsigned int>(e0, uval++);
     registry.emplace<unsigned int>(e1, uval++);
     registry.emplace<unsigned int>(e2, uval++);
-    registry.emplace<unsigned int>(e3, uval+1);
+    registry.emplace<unsigned int>(e3, uval + 1);
 
     registry.emplace<int>(e0, ival++);
     registry.emplace<int>(e1, ival++);
@@ -1067,7 +1069,7 @@ TEST(OwningGroup, ConstNonConstAndAllInBetween) {
     static_assert(std::is_same_v<decltype(group.get<int, const char, double, const float>({})), std::tuple<int &, const char &, double &, const float &>>);
     static_assert(std::is_same_v<decltype(group.get({})), std::tuple<int &, const char &, double &, const float &>>);
     static_assert(std::is_same_v<decltype(group.data()), const entt::entity *>);
-    static_assert(std::is_same_v<decltype(group.raw<const char>()), const char * const *>);
+    static_assert(std::is_same_v<decltype(group.raw<const char>()), const char *const *>);
     static_assert(std::is_same_v<decltype(group.raw<int>()), int **>);
 
     static_assert(std::is_same_v<decltype(std::as_const(registry).group_if_exists<int>(entt::get<char>)), decltype(std::as_const(registry).group_if_exists<const int>(entt::get<const char>))>);

+ 3 - 3
test/entt/entity/handle.cpp

@@ -51,7 +51,7 @@ TEST(BasicHandle, Invalidation) {
     entt::registry registry;
     const auto entity = registry.create();
 
-    handle = { registry, entity };
+    handle = {registry, entity};
 
     ASSERT_TRUE(handle);
     ASSERT_NE(handle.registry(), nullptr);
@@ -137,8 +137,8 @@ TEST(BasicHandle, Comparison) {
     entt::registry other;
     const auto entt = other.create();
 
-    handle = { registry, entity };
-    chandle = { other, entt };
+    handle = {registry, entity};
+    chandle = {other, entt};
 
     ASSERT_NE(handle, chandle);
     ASSERT_FALSE(chandle == handle);

+ 5 - 3
test/entt/entity/helper.cpp

@@ -1,12 +1,14 @@
 #include <gtest/gtest.h>
 #include <entt/core/hashed_string.hpp>
-#include <entt/entity/helper.hpp>
+#include <entt/core/type_traits.hpp>
 #include <entt/entity/entity.hpp>
+#include <entt/entity/helper.hpp>
 #include <entt/entity/registry.hpp>
-#include <entt/core/type_traits.hpp>
 
 struct clazz {
-    void func(entt::registry &, entt::entity curr) { entt = curr; }
+    void func(entt::registry &, entt::entity curr) {
+        entt = curr;
+    }
 
     entt::entity entt{entt::null};
 };

+ 9 - 5
test/entt/entity/observer.cpp

@@ -1,5 +1,5 @@
-#include <tuple>
 #include <cstddef>
+#include <tuple>
 #include <type_traits>
 #include <gtest/gtest.h>
 #include <entt/entity/observer.hpp>
@@ -88,7 +88,8 @@ TEST(Observer, AllOf) {
 TEST(Observer, AllOfFiltered) {
     constexpr auto collector =
         entt::collector
-            .group<int>().where<char>(entt::exclude<double>);
+            .group<int>()
+            .where<char>(entt::exclude<double>);
 
     entt::registry registry;
     entt::observer observer{registry, collector};
@@ -168,7 +169,8 @@ TEST(Observer, Observe) {
 TEST(Observer, ObserveFiltered) {
     constexpr auto collector =
         entt::collector
-            .update<int>().where<char>(entt::exclude<double>);
+            .update<int>()
+            .where<char>(entt::exclude<double>);
 
     entt::registry registry;
     entt::observer observer{registry, collector};
@@ -287,8 +289,10 @@ TEST(Observer, Each) {
 TEST(Observer, MultipleFilters) {
     constexpr auto collector =
         entt::collector
-            .update<int>().where<char>()
-            .update<double>().where<float>();
+            .update<int>()
+            .where<char>()
+            .update<double>()
+            .where<float>();
 
     entt::registry registry;
     entt::observer observer{registry, collector};

+ 4 - 9
test/entt/entity/poly_storage.cpp

@@ -15,10 +15,7 @@ struct PolyStorage
               void(const Entity *, const Entity *, void *),
               void(entt::basic_registry<Entity> &, const Entity, const void *),
               const void *(const Entity) const,
-              void(entt::basic_registry<Entity> &) const
-          >
-      >
-{
+              void(entt::basic_registry<Entity> &) const>> {
     using entity_type = Entity;
     using size_type = std::size_t;
 
@@ -34,7 +31,7 @@ struct PolyStorage
             entt::poly_call<base + 1>(*this, owner, entity, instance);
         }
 
-        const void * get(const entity_type entity) const {
+        const void *get(const entity_type entity) const {
             return entt::poly_call<base + 2>(*this, entity);
         }
 
@@ -49,7 +46,7 @@ struct PolyStorage
             self.emplace(owner, entity, *static_cast<const typename Type::value_type *>(instance));
         }
 
-        static const typename Type::value_type * get(const Type &self, const entity_type entity) {
+        static const typename Type::value_type *get(const Type &self, const entity_type entity) {
             return &self.get(entity);
         }
 
@@ -66,9 +63,7 @@ struct PolyStorage
             &Type::template erase<const entity_type *>,
             &members<Type>::emplace,
             &members<Type>::get,
-            &members<Type>::copy_to
-        >
-    >;
+            &members<Type>::copy_to>>;
 };
 
 template<typename Entity>

+ 41 - 39
test/entt/entity/registry.cpp

@@ -1,9 +1,9 @@
-#include <unordered_set>
+#include <cstdint>
 #include <functional>
 #include <iterator>
 #include <memory>
-#include <cstdint>
 #include <type_traits>
+#include <unordered_set>
 #include <gtest/gtest.h>
 #include <entt/core/type_traits.hpp>
 #include <entt/entity/component.hpp>
@@ -12,7 +12,9 @@
 
 struct empty_type {};
 
-struct stable_type { int value; };
+struct stable_type {
+    int value;
+};
 
 template<>
 struct entt::component_traits<stable_type>: basic_component_traits {
@@ -20,7 +22,8 @@ struct entt::component_traits<stable_type>: basic_component_traits {
 };
 
 struct non_default_constructible {
-    non_default_constructible(int v): value{v} {}
+    non_default_constructible(int v)
+        : value{v} {}
 
     int value;
 };
@@ -939,7 +942,6 @@ TEST(Registry, PartialOwningGroupInitOnFirstUse) {
     ASSERT_FALSE(registry.sortable<int>());
     ASSERT_TRUE(registry.sortable<char>());
     ASSERT_EQ(cnt, 2u);
-
 }
 
 TEST(Registry, PartialOwningGroupInitOnEmplace) {
@@ -1107,28 +1109,28 @@ TEST(Registry, NestedGroups) {
     ASSERT_EQ(g2.size(), 10u);
 
     for(auto i = 0u; i < 5u; ++i) {
-        ASSERT_TRUE(g1.contains(entities[i*2+1]));
-        ASSERT_TRUE(g1.contains(entities[i*2]));
-        ASSERT_TRUE(g2.contains(entities[i*2+1]));
-        ASSERT_TRUE(g2.contains(entities[i*2]));
-        registry.emplace<double>(entities[i*2]);
+        ASSERT_TRUE(g1.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g1.contains(entities[i * 2]));
+        ASSERT_TRUE(g2.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g2.contains(entities[i * 2]));
+        registry.emplace<double>(entities[i * 2]);
     }
 
     ASSERT_EQ(g1.size(), 5u);
     ASSERT_EQ(g2.size(), 10u);
 
     for(auto i = 0u; i < 5u; ++i) {
-        ASSERT_TRUE(g1.contains(entities[i*2+1]));
-        ASSERT_FALSE(g1.contains(entities[i*2]));
-        ASSERT_TRUE(g2.contains(entities[i*2+1]));
-        ASSERT_TRUE(g2.contains(entities[i*2]));
-        registry.erase<int>(entities[i*2+1]);
+        ASSERT_TRUE(g1.contains(entities[i * 2 + 1]));
+        ASSERT_FALSE(g1.contains(entities[i * 2]));
+        ASSERT_TRUE(g2.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g2.contains(entities[i * 2]));
+        registry.erase<int>(entities[i * 2 + 1]);
     }
 
     ASSERT_EQ(g1.size(), 0u);
     ASSERT_EQ(g2.size(), 5u);
 
-    const auto g3= registry.group<int, float>(entt::get<char>, entt::exclude<double>);
+    const auto g3 = registry.group<int, float>(entt::get<char>, entt::exclude<double>);
 
     ASSERT_FALSE(registry.sortable(g1));
     ASSERT_FALSE(registry.sortable(g2));
@@ -1139,13 +1141,13 @@ TEST(Registry, NestedGroups) {
     ASSERT_EQ(g3.size(), 0u);
 
     for(auto i = 0u; i < 5u; ++i) {
-        ASSERT_FALSE(g1.contains(entities[i*2+1]));
-        ASSERT_FALSE(g1.contains(entities[i*2]));
-        ASSERT_FALSE(g2.contains(entities[i*2+1]));
-        ASSERT_TRUE(g2.contains(entities[i*2]));
-        ASSERT_FALSE(g3.contains(entities[i*2+1]));
-        ASSERT_FALSE(g3.contains(entities[i*2]));
-        registry.emplace<int>(entities[i*2+1]);
+        ASSERT_FALSE(g1.contains(entities[i * 2 + 1]));
+        ASSERT_FALSE(g1.contains(entities[i * 2]));
+        ASSERT_FALSE(g2.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g2.contains(entities[i * 2]));
+        ASSERT_FALSE(g3.contains(entities[i * 2 + 1]));
+        ASSERT_FALSE(g3.contains(entities[i * 2]));
+        registry.emplace<int>(entities[i * 2 + 1]);
     }
 
     ASSERT_EQ(g1.size(), 5u);
@@ -1153,13 +1155,13 @@ TEST(Registry, NestedGroups) {
     ASSERT_EQ(g3.size(), 0u);
 
     for(auto i = 0u; i < 5u; ++i) {
-        ASSERT_TRUE(g1.contains(entities[i*2+1]));
-        ASSERT_FALSE(g1.contains(entities[i*2]));
-        ASSERT_TRUE(g2.contains(entities[i*2+1]));
-        ASSERT_TRUE(g2.contains(entities[i*2]));
-        ASSERT_FALSE(g3.contains(entities[i*2+1]));
-        ASSERT_FALSE(g3.contains(entities[i*2]));
-        registry.emplace<float>(entities[i*2]);
+        ASSERT_TRUE(g1.contains(entities[i * 2 + 1]));
+        ASSERT_FALSE(g1.contains(entities[i * 2]));
+        ASSERT_TRUE(g2.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g2.contains(entities[i * 2]));
+        ASSERT_FALSE(g3.contains(entities[i * 2 + 1]));
+        ASSERT_FALSE(g3.contains(entities[i * 2]));
+        registry.emplace<float>(entities[i * 2]);
     }
 
     ASSERT_EQ(g1.size(), 5u);
@@ -1167,7 +1169,7 @@ TEST(Registry, NestedGroups) {
     ASSERT_EQ(g3.size(), 0u);
 
     for(auto i = 0u; i < 5u; ++i) {
-        registry.erase<double>(entities[i*2]);
+        registry.erase<double>(entities[i * 2]);
     }
 
     ASSERT_EQ(g1.size(), 10u);
@@ -1175,14 +1177,14 @@ TEST(Registry, NestedGroups) {
     ASSERT_EQ(g3.size(), 5u);
 
     for(auto i = 0u; i < 5u; ++i) {
-        ASSERT_TRUE(g1.contains(entities[i*2+1]));
-        ASSERT_TRUE(g1.contains(entities[i*2]));
-        ASSERT_TRUE(g2.contains(entities[i*2+1]));
-        ASSERT_TRUE(g2.contains(entities[i*2]));
-        ASSERT_FALSE(g3.contains(entities[i*2+1]));
-        ASSERT_TRUE(g3.contains(entities[i*2]));
-        registry.erase<int>(entities[i*2+1]);
-        registry.erase<int>(entities[i*2]);
+        ASSERT_TRUE(g1.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g1.contains(entities[i * 2]));
+        ASSERT_TRUE(g2.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g2.contains(entities[i * 2]));
+        ASSERT_FALSE(g3.contains(entities[i * 2 + 1]));
+        ASSERT_TRUE(g3.contains(entities[i * 2]));
+        registry.erase<int>(entities[i * 2 + 1]);
+        registry.erase<int>(entities[i * 2]);
     }
 
     ASSERT_EQ(g1.size(), 0u);

+ 14 - 12
test/entt/entity/runtime_view.cpp

@@ -1,12 +1,14 @@
-#include <iterator>
 #include <algorithm>
+#include <iterator>
 #include <gtest/gtest.h>
 #include <entt/core/type_info.hpp>
 #include <entt/entity/component.hpp>
 #include <entt/entity/registry.hpp>
 #include <entt/entity/runtime_view.hpp>
 
-struct stable_type { int value; };
+struct stable_type {
+    int value;
+};
 
 template<>
 struct entt::component_traits<stable_type>: basic_component_traits {
@@ -20,7 +22,7 @@ TEST(RuntimeView, Functionalities) {
     registry.reserve<int>(0);
     registry.reserve<char>(0);
 
-    entt::id_type types[] = { entt::type_hash<int>::value(), entt::type_hash<char>::value() };
+    entt::id_type types[] = {entt::type_hash<int>::value(), entt::type_hash<char>::value()};
     auto view = registry.runtime_view(std::begin(types), std::end(types));
 
     ASSERT_EQ(view.size_hint(), 0u);
@@ -68,7 +70,7 @@ TEST(RuntimeView, Iterator) {
     registry.emplace<int>(entity);
     registry.emplace<char>(entity);
 
-    entt::id_type types[] = { entt::type_hash<int>::value(), entt::type_hash<char>::value() };
+    entt::id_type types[] = {entt::type_hash<int>::value(), entt::type_hash<char>::value()};
     auto view = registry.runtime_view(std::begin(types), std::end(types));
     using iterator = typename decltype(view)::iterator;
 
@@ -104,7 +106,7 @@ TEST(RuntimeView, Contains) {
 
     registry.destroy(e0);
 
-    entt::id_type types[] = { entt::type_hash<int>::value(), entt::type_hash<char>::value() };
+    entt::id_type types[] = {entt::type_hash<int>::value(), entt::type_hash<char>::value()};
     auto view = registry.runtime_view(std::begin(types), std::end(types));
 
     ASSERT_FALSE(view.contains(e0));
@@ -123,7 +125,7 @@ TEST(RuntimeView, Empty) {
     registry.emplace<char>(e1);
     registry.emplace<float>(e1);
 
-    entt::id_type types[] = { entt::type_hash<int>::value(), entt::type_hash<char>::value(), entt::type_hash<float>::value() };
+    entt::id_type types[] = {entt::type_hash<int>::value(), entt::type_hash<char>::value(), entt::type_hash<float>::value()};
     auto view = registry.runtime_view(std::begin(types), std::end(types));
 
     view.each([](auto) { FAIL(); });
@@ -143,7 +145,7 @@ TEST(RuntimeView, Each) {
     registry.emplace<int>(e1);
     registry.emplace<char>(e1);
 
-    entt::id_type types[] = { entt::type_hash<int>::value(), entt::type_hash<char>::value() };
+    entt::id_type types[] = {entt::type_hash<int>::value(), entt::type_hash<char>::value()};
     auto view = registry.runtime_view(std::begin(types), std::end(types));
     std::size_t cnt = 0;
 
@@ -165,7 +167,7 @@ TEST(RuntimeView, EachWithHoles) {
     registry.emplace<int>(e0, 0);
     registry.emplace<int>(e2, 2);
 
-    entt::id_type types[] = { entt::type_hash<int>::value(), entt::type_hash<char>::value() };
+    entt::id_type types[] = {entt::type_hash<int>::value(), entt::type_hash<char>::value()};
     auto view = registry.runtime_view(std::begin(types), std::end(types));
 
     view.each([e0](auto entity) {
@@ -179,7 +181,7 @@ TEST(RuntimeView, MissingPool) {
     const auto e0 = registry.create();
     registry.emplace<int>(e0);
 
-    entt::id_type types[] = { entt::type_hash<int>::value(), entt::type_hash<char>::value() };
+    entt::id_type types[] = {entt::type_hash<int>::value(), entt::type_hash<char>::value()};
     auto view = registry.runtime_view(std::begin(types), std::end(types));
 
     ASSERT_EQ(view.size_hint(), 0u);
@@ -221,8 +223,8 @@ TEST(RuntimeView, ExcludedComponents) {
     registry.emplace<int>(e1);
     registry.emplace<char>(e1);
 
-    entt::id_type components[] = { entt::type_hash<int>::value() };
-    entt::id_type filter[] = { entt::type_hash<char>::value(), entt::type_hash<double>::value() };
+    entt::id_type components[] = {entt::type_hash<int>::value()};
+    entt::id_type filter[] = {entt::type_hash<char>::value(), entt::type_hash<double>::value()};
     auto view = registry.runtime_view(std::begin(components), std::end(components), std::begin(filter), std::end(filter));
 
     ASSERT_TRUE(view.contains(e0));
@@ -249,7 +251,7 @@ TEST(RuntimeView, StableType) {
 
     registry.remove<stable_type>(e1);
 
-    entt::id_type components[] = { entt::type_hash<int>::value(), entt::type_hash<stable_type>::value() };
+    entt::id_type components[] = {entt::type_hash<int>::value(), entt::type_hash<stable_type>::value()};
     auto view = registry.runtime_view(std::begin(components), std::end(components));
 
     ASSERT_EQ(view.size_hint(), 2u);

+ 6 - 2
test/entt/entity/sigh_storage_mixin.cpp

@@ -6,12 +6,16 @@
 #include <entt/entity/storage.hpp>
 
 struct empty_type {};
-struct stable_type { int value; };
+
+struct stable_type {
+    int value;
+};
 
 struct non_default_constructible {
     non_default_constructible() = delete;
 
-    non_default_constructible(int v): value{v} {}
+    non_default_constructible(int v)
+        : value{v} {}
 
     int value;
 };

+ 37 - 44
test/entt/entity/snapshot.cpp

@@ -1,22 +1,25 @@
 #include <map>
-#include <tuple>
 #include <queue>
-#include <vector>
+#include <tuple>
 #include <type_traits>
+#include <vector>
 #include <gtest/gtest.h>
+#include <entt/entity/entity.hpp>
 #include <entt/entity/registry.hpp>
 #include <entt/entity/snapshot.hpp>
-#include <entt/entity/entity.hpp>
 
 struct noncopyable_component {
-    noncopyable_component(): value{} {}
-    explicit noncopyable_component(int v): value{v} {}
+    noncopyable_component()
+        : value{} {}
+
+    explicit noncopyable_component(int v)
+        : value{v} {}
 
     noncopyable_component(const noncopyable_component &) = delete;
     noncopyable_component(noncopyable_component &&) = default;
 
-    noncopyable_component& operator=(const noncopyable_component &) = delete;
-    noncopyable_component& operator=(noncopyable_component &&) = default;
+    noncopyable_component &operator=(const noncopyable_component &) = delete;
+    noncopyable_component &operator=(noncopyable_component &&) = default;
 
     int value;
 };
@@ -24,11 +27,10 @@ struct noncopyable_component {
 template<typename Storage>
 struct output_archive {
     output_archive(Storage &instance)
-        : storage{instance}
-    {}
+        : storage{instance} {}
 
     template<typename... Value>
-    void operator()(const Value &... value) {
+    void operator()(const Value &...value) {
         (std::get<std::queue<Value>>(storage).push(value), ...);
     }
 
@@ -43,11 +45,10 @@ private:
 template<typename Storage>
 struct input_archive {
     input_archive(Storage &instance)
-        : storage{instance}
-    {}
+        : storage{instance} {}
 
     template<typename... Value>
-    void operator()(Value &... value) {
+    void operator()(Value &...value) {
         auto assign = [this](auto &val) {
             auto &queue = std::get<std::queue<std::decay_t<decltype(val)>>>(storage);
             val = queue.front();
@@ -112,8 +113,7 @@ TEST(Snapshot, Dump) {
         std::queue<char>,
         std::queue<double>,
         std::queue<a_component>,
-        std::queue<another_component>
-    >;
+        std::queue<another_component>>;
 
     storage_type storage;
     output_archive<storage_type> output{storage};
@@ -175,8 +175,7 @@ TEST(Snapshot, Partial) {
         std::queue<entt::entity>,
         std::queue<int>,
         std::queue<char>,
-        std::queue<double>
-    >;
+        std::queue<double>>;
 
     storage_type storage;
     output_archive<storage_type> output{storage};
@@ -239,8 +238,7 @@ TEST(Snapshot, Iterator) {
         std::queue<typename traits_type::entity_type>,
         std::queue<entt::entity>,
         std::queue<another_component>,
-        std::queue<int>
-    >;
+        std::queue<int>>;
 
     storage_type storage;
     output_archive<storage_type> output{storage};
@@ -278,8 +276,7 @@ TEST(Snapshot, Continuous) {
         std::queue<what_a_component>,
         std::queue<map_component>,
         std::queue<int>,
-        std::queue<double>
-    >;
+        std::queue<double>>;
 
     storage_type storage;
     output_archive<storage_type> output{storage};
@@ -332,8 +329,8 @@ TEST(Snapshot, Continuous) {
             &what_a_component::quux,
             &map_component::keys,
             &map_component::values,
-            &map_component::both
-        ).orphans();
+            &map_component::both)
+        .orphans();
 
     decltype(dst.size()) a_component_cnt{};
     decltype(dst.size()) another_component_cnt{};
@@ -398,8 +395,8 @@ TEST(Snapshot, Continuous) {
             &what_a_component::quux,
             &map_component::keys,
             &map_component::values,
-            &map_component::both
-        ).orphans();
+            &map_component::both)
+        .orphans();
 
     ASSERT_EQ(size, dst.size());
 
@@ -428,8 +425,8 @@ TEST(Snapshot, Continuous) {
             &what_a_component::quux,
             &map_component::keys,
             &map_component::values,
-            &map_component::both
-        ).orphans();
+            &map_component::both)
+        .orphans();
 
     dst.view<what_a_component>().each([&loader, entity](auto, auto &component) {
         ASSERT_EQ(component.bar, loader.map(entity));
@@ -452,8 +449,9 @@ TEST(Snapshot, Continuous) {
             &what_a_component::quux,
             &map_component::keys,
             &map_component::values,
-            &map_component::both
-        ).orphans().shrink();
+            &map_component::both)
+        .orphans()
+        .shrink();
 
     dst.view<what_a_component>().each([&dst](auto, auto &component) {
         ASSERT_FALSE(dst.valid(component.bar));
@@ -479,8 +477,8 @@ TEST(Snapshot, Continuous) {
             &what_a_component::quux,
             &map_component::keys,
             &map_component::values,
-            &map_component::both
-        ).orphans();
+            &map_component::both)
+        .orphans();
 
     ASSERT_EQ(dst.size<a_component>(), a_component_cnt);
 
@@ -496,8 +494,8 @@ TEST(Snapshot, Continuous) {
             &what_a_component::quux,
             &map_component::keys,
             &map_component::values,
-            &map_component::both
-        ).orphans();
+            &map_component::both)
+        .orphans();
 
     ASSERT_EQ(dst.size<a_component>(), a_component_cnt);
 }
@@ -512,8 +510,7 @@ TEST(Snapshot, MoreOnShrink) {
 
     using storage_type = std::tuple<
         std::queue<typename traits_type::entity_type>,
-        std::queue<entt::entity>
-        >;
+        std::queue<entt::entity>>;
 
     storage_type storage;
     output_archive<storage_type> output{storage};
@@ -542,8 +539,7 @@ TEST(Snapshot, SyncDataMembers) {
         std::queue<typename traits_type::entity_type>,
         std::queue<entt::entity>,
         std::queue<what_a_component>,
-        std::queue<map_component>
-    >;
+        std::queue<map_component>>;
 
     storage_type storage;
     output_archive<storage_type> output{storage};
@@ -557,16 +553,14 @@ TEST(Snapshot, SyncDataMembers) {
     auto parent = src.create();
     auto child = src.create();
 
-
     src.emplace<what_a_component>(parent, entt::null);
     src.emplace<what_a_component>(child, parent).quux.push_back(child);
 
     src.emplace<map_component>(
         child,
-        decltype(map_component::keys){{{ child, 10 }}},
-        decltype(map_component::values){{{ 10, child }}},
-        decltype(map_component::both){{{ child, child }}}
-    );
+        decltype(map_component::keys){{{child, 10}}},
+        decltype(map_component::values){{{10, child}}},
+        decltype(map_component::both){{{child, child}}});
 
     entt::snapshot{src}.entities(output).component<what_a_component, map_component>(output);
 
@@ -576,8 +570,7 @@ TEST(Snapshot, SyncDataMembers) {
         &what_a_component::quux,
         &map_component::keys,
         &map_component::values,
-        &map_component::both
-    );
+        &map_component::both);
 
     ASSERT_FALSE(dst.valid(parent));
     ASSERT_FALSE(dst.valid(child));

+ 19 - 17
test/entt/entity/sparse_set.cpp

@@ -1,9 +1,9 @@
-#include <cstdint>
-#include <utility>
-#include <iterator>
 #include <algorithm>
+#include <cstdint>
 #include <functional>
+#include <iterator>
 #include <type_traits>
+#include <utility>
 #include <gtest/gtest.h>
 #include <entt/entity/entity.hpp>
 #include <entt/entity/sparse_set.hpp>
@@ -11,7 +11,9 @@
 
 struct empty_type {};
 
-struct boxed_int { int value; };
+struct boxed_int {
+    int value;
+};
 
 TEST(SparseSet, Functionalities) {
     entt::sparse_set set;
@@ -218,29 +220,29 @@ TEST(SparseSet, Pagination) {
 
     ASSERT_EQ(set.extent(), 0u);
 
-    set.emplace(entt::entity{ENTT_SPARSE_PAGE-1u});
+    set.emplace(entt::entity{ENTT_SPARSE_PAGE - 1u});
 
     ASSERT_EQ(set.extent(), ENTT_SPARSE_PAGE);
-    ASSERT_TRUE(set.contains(entt::entity{ENTT_SPARSE_PAGE-1u}));
+    ASSERT_TRUE(set.contains(entt::entity{ENTT_SPARSE_PAGE - 1u}));
 
     set.emplace(entt::entity{ENTT_SPARSE_PAGE});
 
     ASSERT_EQ(set.extent(), 2 * ENTT_SPARSE_PAGE);
-    ASSERT_TRUE(set.contains(entt::entity{ENTT_SPARSE_PAGE-1u}));
+    ASSERT_TRUE(set.contains(entt::entity{ENTT_SPARSE_PAGE - 1u}));
     ASSERT_TRUE(set.contains(entt::entity{ENTT_SPARSE_PAGE}));
-    ASSERT_FALSE(set.contains(entt::entity{ENTT_SPARSE_PAGE+1u}));
+    ASSERT_FALSE(set.contains(entt::entity{ENTT_SPARSE_PAGE + 1u}));
 
-    set.erase(entt::entity{ENTT_SPARSE_PAGE-1u});
+    set.erase(entt::entity{ENTT_SPARSE_PAGE - 1u});
 
     ASSERT_EQ(set.extent(), 2 * ENTT_SPARSE_PAGE);
-    ASSERT_FALSE(set.contains(entt::entity{ENTT_SPARSE_PAGE-1u}));
+    ASSERT_FALSE(set.contains(entt::entity{ENTT_SPARSE_PAGE - 1u}));
     ASSERT_TRUE(set.contains(entt::entity{ENTT_SPARSE_PAGE}));
 
     set.shrink_to_fit();
     set.erase(entt::entity{ENTT_SPARSE_PAGE});
 
     ASSERT_EQ(set.extent(), 2 * ENTT_SPARSE_PAGE);
-    ASSERT_FALSE(set.contains(entt::entity{ENTT_SPARSE_PAGE-1u}));
+    ASSERT_FALSE(set.contains(entt::entity{ENTT_SPARSE_PAGE - 1u}));
     ASSERT_FALSE(set.contains(entt::entity{ENTT_SPARSE_PAGE}));
 
     set.shrink_to_fit();
@@ -264,7 +266,7 @@ TEST(SparseSet, Emplace) {
 
     ASSERT_DEATH(set.emplace(traits_type::combine(3, 1)), "");
     ASSERT_DEATH(set.emplace(entities[1u]), "");
-    
+
     ASSERT_EQ(set.at(0u), entities[1u]);
     ASSERT_EQ(set.at(1u), entities[0u]);
     ASSERT_EQ(set.index(entities[0u]), 1u);
@@ -283,7 +285,7 @@ TEST(SparseSet, Emplace) {
 TEST(SparseSet, EmplaceOutOfBounds) {
     entt::sparse_set set{entt::deletion_policy::in_place};
     entt::entity entities[2u]{entt::entity{0}, entt::entity{ENTT_SPARSE_PAGE}};
-    
+
     set.emplace(entities[0u]);
 
     ASSERT_EQ(set.extent(), ENTT_SPARSE_PAGE);
@@ -803,8 +805,8 @@ TEST(SparseSet, Iterator) {
     ASSERT_EQ(begin++, set.begin());
     ASSERT_EQ(begin--, set.end());
 
-    ASSERT_EQ(begin+1, set.end());
-    ASSERT_EQ(end-1, set.begin());
+    ASSERT_EQ(begin + 1, set.end());
+    ASSERT_EQ(end - 1, set.begin());
 
     ASSERT_EQ(++begin, set.end());
     ASSERT_EQ(--begin, set.begin());
@@ -852,8 +854,8 @@ TEST(SparseSet, ReverseIterator) {
     ASSERT_EQ(begin++, set.rbegin());
     ASSERT_EQ(begin--, set.rend());
 
-    ASSERT_EQ(begin+1, set.rend());
-    ASSERT_EQ(end-1, set.rbegin());
+    ASSERT_EQ(begin + 1, set.rend());
+    ASSERT_EQ(end - 1, set.rbegin());
 
     ASSERT_EQ(++begin, set.rend());
     ASSERT_EQ(--begin, set.rbegin());

+ 29 - 24
test/entt/entity/storage.cpp

@@ -1,9 +1,9 @@
-#include <memory>
-#include <utility>
-#include <iterator>
 #include <exception>
+#include <iterator>
+#include <memory>
 #include <type_traits>
 #include <unordered_set>
+#include <utility>
 #include <gtest/gtest.h>
 #include <entt/entity/component.hpp>
 #include <entt/entity/storage.hpp>
@@ -12,14 +12,19 @@
 
 struct empty_type {};
 
-struct boxed_int { int value; };
+struct boxed_int {
+    int value;
+};
 
-struct stable_type { int value; };
+struct stable_type {
+    int value;
+};
 
 struct non_default_constructible {
     non_default_constructible() = delete;
 
-    non_default_constructible(int v): value{v} {}
+    non_default_constructible(int v)
+        : value{v} {}
 
     int value;
 };
@@ -27,15 +32,13 @@ struct non_default_constructible {
 struct update_from_destructor {
     update_from_destructor(entt::storage<update_from_destructor> &ref, entt::entity other)
         : storage{&ref},
-          target{other}
-    {}
+          target{other} {}
 
     update_from_destructor(update_from_destructor &&other) ENTT_NOEXCEPT
         : storage{std::exchange(other.storage, nullptr)},
-          target{std::exchange(other.target, entt::null)}
-    {}
+          target{std::exchange(other.target, entt::null)} {}
 
-    update_from_destructor & operator=(update_from_destructor &&other) ENTT_NOEXCEPT {
+    update_from_destructor &operator=(update_from_destructor &&other) ENTT_NOEXCEPT {
         storage = std::exchange(other.storage, nullptr);
         target = std::exchange(other.target, entt::null);
         return *this;
@@ -239,7 +242,7 @@ TEST(Storage, Insert) {
     ASSERT_EQ(pool.get(entities[1u]).value, 99);
 
     pool.erase(std::begin(entities), std::end(entities));
-    const stable_type values[2u] = { stable_type{42}, stable_type{3} };
+    const stable_type values[2u] = {stable_type{42}, stable_type{3}};
     pool.insert(std::rbegin(entities), std::rend(entities), std::begin(values));
 
     ASSERT_EQ(pool.size(), 2u);
@@ -719,7 +722,9 @@ TEST(Storage, ShrinkToFit) {
 }
 
 TEST(Storage, AggregatesMustWork) {
-    struct aggregate_type { int value; };
+    struct aggregate_type {
+        int value;
+    };
 
     // the goal of this test is to enforce the requirements for aggregate types
     entt::storage<aggregate_type>{}.emplace(entt::entity{0}, 42);
@@ -754,8 +759,8 @@ TEST(Storage, Iterator) {
     ASSERT_EQ(begin++, pool.begin());
     ASSERT_EQ(begin--, pool.end());
 
-    ASSERT_EQ(begin+1, pool.end());
-    ASSERT_EQ(end-1, pool.begin());
+    ASSERT_EQ(begin + 1, pool.end());
+    ASSERT_EQ(end - 1, pool.begin());
 
     ASSERT_EQ(++begin, pool.end());
     ASSERT_EQ(--begin, pool.begin());
@@ -800,8 +805,8 @@ TEST(Storage, ConstIterator) {
     ASSERT_EQ(cbegin++, pool.cbegin());
     ASSERT_EQ(cbegin--, pool.cend());
 
-    ASSERT_EQ(cbegin+1, pool.cend());
-    ASSERT_EQ(cend-1, pool.cbegin());
+    ASSERT_EQ(cbegin + 1, pool.cend());
+    ASSERT_EQ(cend - 1, pool.cbegin());
 
     ASSERT_EQ(++cbegin, pool.cend());
     ASSERT_EQ(--cbegin, pool.cbegin());
@@ -846,8 +851,8 @@ TEST(Storage, ReverseIterator) {
     ASSERT_EQ(begin++, pool.rbegin());
     ASSERT_EQ(begin--, pool.rend());
 
-    ASSERT_EQ(begin+1, pool.rend());
-    ASSERT_EQ(end-1, pool.rbegin());
+    ASSERT_EQ(begin + 1, pool.rend());
+    ASSERT_EQ(end - 1, pool.rbegin());
 
     ASSERT_EQ(++begin, pool.rend());
     ASSERT_EQ(--begin, pool.rbegin());
@@ -892,8 +897,8 @@ TEST(Storage, ConstReverseIterator) {
     ASSERT_EQ(cbegin++, pool.crbegin());
     ASSERT_EQ(cbegin--, pool.crend());
 
-    ASSERT_EQ(cbegin+1, pool.crend());
-    ASSERT_EQ(cend-1, pool.crbegin());
+    ASSERT_EQ(cbegin + 1, pool.crend());
+    ASSERT_EQ(cend - 1, pool.crbegin());
 
     ASSERT_EQ(++cbegin, pool.crend());
     ASSERT_EQ(--cbegin, pool.crbegin());
@@ -1230,13 +1235,13 @@ TEST(Storage, UpdateFromDestructor) {
 
         for(std::size_t next{}; next < size; ++next) {
             const auto entity = entt::entity(next);
-            pool.emplace(entity, pool, entity == entt::entity(size/2) ? target : entity);
+            pool.emplace(entity, pool, entity == entt::entity(size / 2) ? target : entity);
         }
 
-        pool.erase(entt::entity(size/2));
+        pool.erase(entt::entity(size / 2));
 
         ASSERT_EQ(pool.size(), size - 1u - (target != entt::null));
-        ASSERT_FALSE(pool.contains(entt::entity(size/2)));
+        ASSERT_FALSE(pool.contains(entt::entity(size / 2)));
         ASSERT_FALSE(pool.contains(target));
 
         pool.clear();

+ 4 - 9
test/entt/entity/throwing_allocator.hpp

@@ -1,15 +1,12 @@
 #ifndef ENTT_ENTITY_THROWING_ALLOCATOR_HPP
 #define ENTT_ENTITY_THROWING_ALLOCATOR_HPP
 
-
 #include <cstddef>
 #include <memory>
 #include <type_traits>
 
-
 namespace test {
 
-
 template<typename Type>
 class throwing_allocator: std::allocator<Type> {
     template<typename Other>
@@ -28,7 +25,8 @@ public:
     using propagate_on_container_swap = std::true_type;
     using exception_type = test_exception;
 
-    template<class Other> struct rebind {
+    template<class Other>
+    struct rebind {
         using other = throwing_allocator<Other>;
     };
 
@@ -36,8 +34,7 @@ public:
 
     template<class Other>
     throwing_allocator(const throwing_allocator<Other> &other)
-        : base{other}
-    {}
+        : base{other} {}
 
     pointer allocate(std::size_t length) {
         if(trigger_on_allocate) {
@@ -67,8 +64,6 @@ public:
     static inline bool trigger_after_allocate{};
 };
 
-
-}
-
+} // namespace test
 
 #endif

+ 4 - 10
test/entt/entity/throwing_component.hpp

@@ -1,10 +1,8 @@
 #ifndef ENTT_ENTITY_THROWING_COMPONENT_HPP
 #define ENTT_ENTITY_THROWING_COMPONENT_HPP
 
-
 namespace test {
 
-
 class throwing_component {
     struct test_exception {};
 
@@ -13,19 +11,17 @@ public:
     static constexpr auto moved_from_value = -1;
 
     throwing_component(int value)
-        : data{value}
-    {}
+        : data{value} {}
 
     throwing_component(const throwing_component &other)
-        : data{other.data}
-    {
+        : data{other.data} {
         if(data == trigger_on_value) {
             data = moved_from_value;
             throw exception_type{};
         }
     }
 
-    throwing_component & operator=(const throwing_component &other) {
+    throwing_component &operator=(const throwing_component &other) {
         if(other.data == trigger_on_value) {
             data = moved_from_value;
             throw exception_type{};
@@ -45,8 +41,6 @@ private:
     int data{};
 };
 
-
-}
-
+} // namespace test
 
 #endif

+ 6 - 4
test/entt/entity/view.cpp

@@ -1,7 +1,7 @@
 #include <algorithm>
 #include <tuple>
-#include <utility>
 #include <type_traits>
+#include <utility>
 #include <gtest/gtest.h>
 #include <entt/entity/component.hpp>
 #include <entt/entity/registry.hpp>
@@ -9,7 +9,9 @@
 
 struct empty_type {};
 
-struct stable_type { int value; };
+struct stable_type {
+    int value;
+};
 
 template<>
 struct entt::component_traits<stable_type>: basic_component_traits {
@@ -236,14 +238,14 @@ TEST(SingleComponentView, ConstNonConstAndAllInBetween) {
     ASSERT_EQ(cview.size(), 1u);
 
     static_assert(std::is_same_v<decltype(view.raw()), int **>);
-    static_assert(std::is_same_v<decltype(cview.raw()), const int * const *>);
+    static_assert(std::is_same_v<decltype(cview.raw()), const int *const *>);
 
     static_assert(std::is_same_v<decltype(view.get<int>({})), int &>);
     static_assert(std::is_same_v<decltype(view.get({})), std::tuple<int &>>);
     static_assert(std::is_same_v<decltype(view.raw()), int **>);
     static_assert(std::is_same_v<decltype(cview.get<const int>({})), const int &>);
     static_assert(std::is_same_v<decltype(cview.get({})), std::tuple<const int &>>);
-    static_assert(std::is_same_v<decltype(cview.raw()), const int * const *>);
+    static_assert(std::is_same_v<decltype(cview.raw()), const int *const *>);
 
     static_assert(std::is_same_v<decltype(std::as_const(registry).view<int>()), decltype(cview)>);
 

+ 5 - 2
test/entt/locator/locator.cpp

@@ -10,9 +10,12 @@ struct another_service {
 };
 
 struct derived_service: another_service {
-    derived_service(int): another_service{} {}
+    derived_service(int)
+        : another_service{} {}
 
-    void f(bool b) override { check = b; }
+    void f(bool b) override {
+        check = b;
+    }
 };
 
 TEST(ServiceLocator, Functionalities) {

+ 17 - 12
test/entt/meta/meta_any.cpp

@@ -7,13 +7,20 @@
 #include <entt/meta/resolve.hpp>
 
 struct clazz_t {
-    clazz_t(): value{0} {}
+    clazz_t()
+        : value{0} {}
 
-    void member(int i) { value = i; }
+    void member(int i) {
+        value = i;
+    }
 
-    static void func() { c = 'd'; }
+    static void func() {
+        c = 'd';
+    }
 
-    operator int() const { return value; }
+    operator int() const {
+        return value;
+    }
 
     static inline char c = 'c';
     int value;
@@ -34,12 +41,10 @@ struct empty_t {
 
 struct fat_t: empty_t {
     fat_t()
-        : value{.0, .0, .0, .0}
-    {}
+        : value{.0, .0, .0, .0} {}
 
     fat_t(double v1, double v2, double v3, double v4)
-        : value{v1, v2, v3, v4}
-    {}
+        : value{v1, v2, v3, v4} {}
 
     bool operator==(const fat_t &other) const {
         return std::equal(std::begin(value), std::end(value), std::begin(other.value), std::end(other.value));
@@ -48,7 +53,7 @@ struct fat_t: empty_t {
     double value[4];
 };
 
-enum class enum_class: unsigned short int {
+enum class enum_class : unsigned short int {
     foo = 0u,
     bar = 42u
 };
@@ -61,8 +66,8 @@ struct unmanageable_t {
     unmanageable_t() = default;
     unmanageable_t(const unmanageable_t &) = delete;
     unmanageable_t(unmanageable_t &&) = delete;
-    unmanageable_t & operator=(const unmanageable_t &) = delete;
-    unmanageable_t & operator=(unmanageable_t &&) = delete;
+    unmanageable_t &operator=(const unmanageable_t &) = delete;
+    unmanageable_t &operator=(unmanageable_t &&) = delete;
 };
 
 struct MetaAny: ::testing::Test {
@@ -525,7 +530,7 @@ TEST_F(MetaAny, SBODestruction) {
     }
 
     ASSERT_EQ(empty_t::destroy_counter, 3);
-    ASSERT_EQ(empty_t::destructor_counter,6);
+    ASSERT_EQ(empty_t::destructor_counter, 6);
 }
 
 TEST_F(MetaAny, NoSBODestruction) {

+ 3 - 1
test/entt/meta/meta_conv.cpp

@@ -8,7 +8,9 @@
 struct clazz_t {
     clazz_t() = default;
 
-    operator int() const { return value; }
+    operator int() const {
+        return value;
+    }
 
     int value;
 };

+ 14 - 10
test/entt/meta/meta_ctor.cpp

@@ -7,39 +7,43 @@
 #include <entt/meta/resolve.hpp>
 
 struct base_t {
-    base_t(): value{'c'} {}
+    base_t()
+        : value{'c'} {}
 
     char value;
 };
 
 struct derived_t: base_t {
-    derived_t(): base_t{} {}
+    derived_t()
+        : base_t{} {}
 };
 
 struct clazz_t {
     clazz_t(const base_t &other, int &iv)
-        : clazz_t{iv, other.value}
-    {}
+        : clazz_t{iv, other.value} {}
 
     clazz_t(const int &iv, char cv)
-        : i{iv}, c{cv}
-    {}
+        : i{iv}, c{cv} {}
 
-    operator int() const { return i; }
+    operator int() const {
+        return i;
+    }
 
     static clazz_t factory(int value) {
-        return { value, 'c' };
+        return {value, 'c'};
     }
 
     static clazz_t factory(base_t other, int value, int mul) {
-        return { value * mul, other.value };
+        return {value * mul, other.value};
     }
 
     int i{};
     char c{};
 };
 
-double double_factory() { return 42.; }
+double double_factory() {
+    return 42.;
+}
 
 struct MetaCtor: ::testing::Test {
     void SetUp() override {

+ 17 - 10
test/entt/meta/meta_data.cpp

@@ -25,10 +25,11 @@ struct clazz_t {
     clazz_t()
         : i{0},
           j{1},
-          base{}
-    {}
+          base{} {}
 
-    operator int() const { return h; }
+    operator int() const {
+        return h;
+    }
 
     int i{0};
     const int j{1};
@@ -38,7 +39,8 @@ struct clazz_t {
 };
 
 struct setter_getter_t {
-    setter_getter_t(): value{0} {}
+    setter_getter_t()
+        : value{0} {}
 
     int setter(double val) {
         return value = static_cast<int>(val);
@@ -52,7 +54,7 @@ struct setter_getter_t {
         return value = val;
     }
 
-    const int & getter_with_ref() {
+    const int &getter_with_ref() {
         return value;
     }
 
@@ -68,7 +70,8 @@ struct setter_getter_t {
 };
 
 struct multi_setter_t {
-    multi_setter_t(): value{0} {}
+    multi_setter_t()
+        : value{0} {}
 
     void from_double(double val) {
         value = val;
@@ -110,11 +113,15 @@ struct MetaData: ::testing::Test {
 
         entt::meta<clazz_t>()
             .type("clazz"_hs)
-            .data<&clazz_t::i, entt::as_ref_t>("i"_hs).prop(3, 0)
+            .data<&clazz_t::i, entt::as_ref_t>("i"_hs)
+            .prop(3, 0)
             .data<&clazz_t::i, entt::as_cref_t>("ci"_hs)
-            .data<&clazz_t::j>("j"_hs).prop(true, 1)
-            .data<&clazz_t::h>("h"_hs).prop(property_t::random, 2)
-            .data<&clazz_t::k>("k"_hs).prop(property_t::value, 3)
+            .data<&clazz_t::j>("j"_hs)
+            .prop(true, 1)
+            .data<&clazz_t::h>("h"_hs)
+            .prop(property_t::random, 2)
+            .data<&clazz_t::k>("k"_hs)
+            .prop(property_t::value, 3)
             .data<&clazz_t::base>("base"_hs)
             .data<&clazz_t::i, entt::as_void_t>("void"_hs)
             .conv<int>();

+ 16 - 10
test/entt/meta/meta_func.cpp

@@ -22,7 +22,8 @@ struct base_t {
 };
 
 struct derived_t: base_t {
-    derived_t(): base_t{} {}
+    derived_t()
+        : base_t{} {}
 };
 
 struct func_t {
@@ -32,15 +33,15 @@ struct func_t {
 
     int f(int a, int b) {
         value = a;
-        return b*b;
+        return b * b;
     }
 
     int f(int v) const {
-        return v*v;
+        return v * v;
     }
 
     void g(int v) {
-        value = v*v;
+        value = v * v;
     }
 
     static int h(int &v) {
@@ -55,7 +56,7 @@ struct func_t {
         return (value = v);
     }
 
-    int & a() const {
+    int &a() const {
         return value;
     }
 
@@ -87,11 +88,16 @@ struct MetaFunc: ::testing::Test {
             .type("func"_hs)
             .func<&entt::registry::emplace_or_replace<func_t>, entt::as_ref_t>("emplace"_hs)
             .func<entt::overload<int(const base_t &, int, int)>(&func_t::f)>("f3"_hs)
-            .func<entt::overload<int(int, int)>(&func_t::f)>("f2"_hs).prop(true, false)
-            .func<entt::overload<int(int) const>(&func_t::f)>("f1"_hs).prop(true, false)
-            .func<&func_t::g>("g"_hs).prop(true, false)
-            .func<func_t::h>("h"_hs).prop(true, false)
-            .func<func_t::k>("k"_hs).prop(true, false)
+            .func<entt::overload<int(int, int)>(&func_t::f)>("f2"_hs)
+            .prop(true, false)
+            .func<entt::overload<int(int) const>(&func_t::f)>("f1"_hs)
+            .prop(true, false)
+            .func<&func_t::g>("g"_hs)
+            .prop(true, false)
+            .func<func_t::h>("h"_hs)
+            .prop(true, false)
+            .func<func_t::k>("k"_hs)
+            .prop(true, false)
             .func<&func_t::v, entt::as_void_t>("v"_hs)
             .func<&func_t::a, entt::as_ref_t>("a"_hs)
             .func<&func_t::a, entt::as_cref_t>("ca"_hs)

+ 8 - 3
test/entt/meta/meta_handle.cpp

@@ -5,11 +5,16 @@
 #include <entt/meta/resolve.hpp>
 
 struct clazz_t {
-    clazz_t(): value{} {}
+    clazz_t()
+        : value{} {}
 
-    void incr() { ++value; }
+    void incr() {
+        ++value;
+    }
 
-    void decr() { --value; }
+    void decr() {
+        --value;
+    }
 
     int value;
 };

+ 26 - 15
test/entt/meta/meta_pointer.cpp

@@ -8,9 +8,12 @@
 
 template<typename Type>
 struct wrapped_shared_ptr {
-    wrapped_shared_ptr(Type init): ptr{new Type {init}} {}
+    wrapped_shared_ptr(Type init)
+        : ptr{new Type{init}} {}
 
-    Type & deref() const { return *ptr; }
+    Type &deref() const {
+        return *ptr;
+    }
 
 private:
     std::shared_ptr<Type> ptr;
@@ -19,9 +22,12 @@ private:
 struct self_ptr {
     using element_type = self_ptr;
 
-    self_ptr(int v): value{v} {}
+    self_ptr(int v)
+        : value{v} {}
 
-    const self_ptr & operator*() const { return *this; }
+    const self_ptr &operator*() const {
+        return *this;
+    }
 
     int value;
 };
@@ -29,9 +35,12 @@ struct self_ptr {
 struct proxy_ptr {
     using element_type = proxy_ptr;
 
-    proxy_ptr(int &v): value{&v} {}
+    proxy_ptr(int &v)
+        : value{&v} {}
 
-    proxy_ptr operator*() const { return *this; }
+    proxy_ptr operator*() const {
+        return *this;
+    }
 
     int *value;
 };
@@ -62,18 +71,20 @@ struct entt::adl_meta_pointer_like<spec_wrapped_shared_ptr<Type>> {
 };
 
 template<typename Type>
-Type & dereference_meta_pointer_like(const adl_wrapped_shared_ptr<Type> &ptr) {
+Type &dereference_meta_pointer_like(const adl_wrapped_shared_ptr<Type> &ptr) {
     return ptr.deref();
 }
 
-int test_function() { return 42; }
+int test_function() {
+    return 42;
+}
 
 struct not_copyable_t {
     not_copyable_t() = default;
     not_copyable_t(const not_copyable_t &) = delete;
     not_copyable_t(not_copyable_t &&) = default;
-    not_copyable_t & operator=(const not_copyable_t &) = delete;
-    not_copyable_t & operator=(not_copyable_t &&) = default;
+    not_copyable_t &operator=(const not_copyable_t &) = delete;
+    not_copyable_t &operator=(not_copyable_t &&) = default;
 };
 
 TEST(MetaPointerLike, DereferenceOperatorInvalidType) {
@@ -199,7 +210,7 @@ TEST(MetaPointerLike, PointerToConstMoveOnlyType) {
 
 TEST(MetaPointerLike, AsRef) {
     int value = 0;
-    int * ptr = &value;
+    int *ptr = &value;
     entt::meta_any any{entt::forward_as_meta(ptr)};
 
     ASSERT_TRUE(any.type().is_pointer());
@@ -221,7 +232,7 @@ TEST(MetaPointerLike, AsRef) {
 
 TEST(MetaPointerLike, AsConstRef) {
     int value = 42;
-    int * const ptr = &value;
+    int *const ptr = &value;
     entt::meta_any any{entt::forward_as_meta(ptr)};
 
     ASSERT_TRUE(any.type().is_pointer());
@@ -307,15 +318,15 @@ TEST(MetaPointerLike, DereferenceSmartPointerToVoid) {
     };
 
     test(std::shared_ptr<void>{});
-    test(std::unique_ptr<void, void(*)(void *)>{nullptr, nullptr});
+    test(std::unique_ptr<void, void (*)(void *)>{nullptr, nullptr});
 }
 
 TEST(MetaPointerLike, DereferencePointerToFunction) {
     auto test = [](entt::meta_any any) {
         ASSERT_TRUE(any.type().is_pointer());
         ASSERT_TRUE(any.type().is_pointer_like());
-        ASSERT_NE(any.try_cast<int(*)()>(), nullptr);
-        ASSERT_EQ(any.cast<int(*)()>()(), 42);
+        ASSERT_NE(any.try_cast<int (*)()>(), nullptr);
+        ASSERT_EQ(any.cast<int (*)()>()(), 42);
     };
 
     entt::meta_any func{&test_function};

+ 17 - 14
test/entt/meta/meta_type.cpp

@@ -22,13 +22,15 @@ Type get(Type &prop) {
 }
 
 struct base_t {
-    base_t(): value{'c'} {};
+    base_t()
+        : value{'c'} {};
 
     char value;
 };
 
 struct derived_t: base_t {
-    derived_t(): base_t{} {}
+    derived_t()
+        : base_t{} {}
 };
 
 struct abstract_t {
@@ -50,13 +52,14 @@ struct clazz_t {
     clazz_t() = default;
 
     clazz_t(const base_t &, int v)
-        : value{v}
-    {}
+        : value{v} {}
 
     void member() {}
     static void func() {}
 
-    operator int() const { return value; }
+    operator int() const {
+        return value;
+    }
 
     int value;
 };
@@ -130,28 +133,28 @@ struct MetaType: ::testing::Test {
 
         entt::meta<overloaded_func_t>()
             .type("overloaded_func"_hs)
-            .func<&overloaded_func_t::e> ("e"_hs)
+            .func<&overloaded_func_t::e>("e"_hs)
             .func<entt::overload<int(const base_t &, int, int)>(&overloaded_func_t::f)>("f"_hs)
             .func<entt::overload<int(int, int)>(&overloaded_func_t::f)>("f"_hs)
             .func<entt::overload<int(int) const>(&overloaded_func_t::f)>("f"_hs)
-            .func<entt::overload<float(int, float)> (&overloaded_func_t::f)> ("f"_hs)
-            .func<&overloaded_func_t::g> ("g"_hs);
+            .func<entt::overload<float(int, float)>(&overloaded_func_t::f)>("f"_hs)
+            .func<&overloaded_func_t::g>("g"_hs);
 
         entt::meta<property_t>()
             .type("property"_hs)
             .data<property_t::random>("random"_hs)
-                .props(std::make_pair(property_t::random, 0), std::make_pair(property_t::value, 3))
+            .props(std::make_pair(property_t::random, 0), std::make_pair(property_t::value, 3))
             .data<property_t::value>("value"_hs)
-                .props(std::make_pair(property_t::random, true), std::make_pair(property_t::value, 0), property_t::key_only, property_t::list)
+            .props(std::make_pair(property_t::random, true), std::make_pair(property_t::value, 0), property_t::key_only, property_t::list)
             .data<property_t::key_only>("key_only"_hs)
-                .prop(property_t::key_only)
+            .prop(property_t::key_only)
             .data<property_t::list>("list"_hs)
-                .props(std::make_pair(property_t::random, false), std::make_pair(property_t::value, 0), property_t::key_only)
+            .props(std::make_pair(property_t::random, false), std::make_pair(property_t::value, 0), property_t::key_only)
             .data<set<property_t>, get<property_t>>("var"_hs);
 
         entt::meta<clazz_t>()
             .type("clazz"_hs)
-                .prop(property_t::value, 42)
+            .prop(property_t::value, 42)
             .ctor<const base_t &, int>()
             .data<&clazz_t::value>("value"_hs)
             .func<&clazz_t::member>("member"_hs)
@@ -606,7 +609,7 @@ TEST_F(MetaType, ResetAndReRegistrationAfterReset) {
     entt::meta<property_t>()
         .type("property"_hs)
         .data<property_t::random>("rand"_hs)
-            .props(std::make_pair(property_t::value, 42), std::make_pair(property_t::random, 3));
+        .props(std::make_pair(property_t::value, 42), std::make_pair(property_t::random, 3));
 
     ASSERT_TRUE(entt::resolve<property_t>().data("rand"_hs).prop(property_t::value));
     ASSERT_TRUE(entt::resolve<property_t>().data("rand"_hs).prop(property_t::random));

+ 42 - 19
test/entt/poly/poly_deduced.cpp

@@ -5,26 +5,39 @@
 #include <entt/poly/poly.hpp>
 
 struct Deduced
-    : entt::type_list<>
-{
+    : entt::type_list<> {
     template<typename Base>
     struct type: Base {
-        void incr() { entt::poly_call<0>(*this); }
+        void incr() {
+            entt::poly_call<0>(*this);
+        }
 
-        void set(int v) { entt::poly_call<1>(*this, v); }
+        void set(int v) {
+            entt::poly_call<1>(*this, v);
+        }
 
-        int get() const { return entt::poly_call<2>(*this); }
+        int get() const {
+            return entt::poly_call<2>(*this);
+        }
 
-        void decr() { entt::poly_call<3>(*this); }
+        void decr() {
+            entt::poly_call<3>(*this);
+        }
 
-        int mul(int v) const { return static_cast<int>(entt::poly_call<4>(*this, v)); }
+        int mul(int v) const {
+            return static_cast<int>(entt::poly_call<4>(*this, v));
+        }
     };
 
     template<typename Type>
     struct members {
-        static void decr(Type &self) { self.set(self.get()-1); }
+        static void decr(Type &self) {
+            self.set(self.get() - 1);
+        }
 
-        static double mul(const Type &self, double v) { return v * self.get(); }
+        static double mul(const Type &self, double v) {
+            return v * self.get();
+        }
     };
 
     template<typename Type>
@@ -33,24 +46,34 @@ struct Deduced
         &Type::set,
         &Type::get,
         &members<Type>::decr,
-        &members<Type>::mul
-    >;
+        &members<Type>::mul>;
 };
 
 struct impl {
     impl() = default;
 
-    impl(int v): value{v} {}
+    impl(int v)
+        : value{v} {}
 
-    void incr() { ++value; }
+    void incr() {
+        ++value;
+    }
 
-    void set(int v) { value = v; }
+    void set(int v) {
+        value = v;
+    }
 
-    int get() const { return value; }
+    int get() const {
+        return value;
+    }
 
-    void decrement() { --value; }
+    void decrement() {
+        --value;
+    }
 
-    double multiply(double v) const { return v * value; }
+    double multiply(double v) const {
+        return v * value;
+    }
 
     int value{};
 };
@@ -261,9 +284,9 @@ TEST(PolyDeduced, Alignment) {
         cb(data, target[1].data());
     };
 
-    entt::basic_poly<Deduced, alignment> nosbo[2] = { over_aligned{}, over_aligned{} };
+    entt::basic_poly<Deduced, alignment> nosbo[2] = {over_aligned{}, over_aligned{}};
     test(nosbo, [](auto *pre, auto *post) { ASSERT_EQ(pre, post); });
 
-    entt::basic_poly<Deduced, alignment, alignment> sbo[2] = { over_aligned{}, over_aligned{} };
+    entt::basic_poly<Deduced, alignment, alignment> sbo[2] = {over_aligned{}, over_aligned{}};
     test(sbo, [](auto *pre, auto *post) { ASSERT_NE(pre, post); });
 }

+ 46 - 24
test/entt/poly/poly_defined.cpp

@@ -6,31 +6,43 @@
 
 struct Defined
     : entt::type_list<
-        void(),
-        void(int),
-        int() const,
-        void(),
-        int(int) const
-      >
-{
+          void(),
+          void(int),
+          int() const,
+          void(),
+          int(int) const> {
     template<typename Base>
     struct type: Base {
-        void incr() { entt::poly_call<0>(*this); }
+        void incr() {
+            entt::poly_call<0>(*this);
+        }
 
-        void set(int v) { entt::poly_call<1>(*this, v); }
+        void set(int v) {
+            entt::poly_call<1>(*this, v);
+        }
 
-        int get() const { return entt::poly_call<2>(*this); }
+        int get() const {
+            return entt::poly_call<2>(*this);
+        }
 
-        void decr() { entt::poly_call<3>(*this); }
+        void decr() {
+            entt::poly_call<3>(*this);
+        }
 
-        int mul(int v) const { return entt::poly_call<4>(*this, v); }
+        int mul(int v) const {
+            return entt::poly_call<4>(*this, v);
+        }
     };
 
     template<typename Type>
     struct members {
-        static void decr(Type &self) { self.decrement(); }
+        static void decr(Type &self) {
+            self.decrement();
+        }
 
-        static double mul(const Type &self, double v) { return self.multiply(v); }
+        static double mul(const Type &self, double v) {
+            return self.multiply(v);
+        }
     };
 
     template<typename Type>
@@ -39,24 +51,34 @@ struct Defined
         &Type::set,
         &Type::get,
         &members<Type>::decr,
-        &members<Type>::mul
-    >;
+        &members<Type>::mul>;
 };
 
 struct impl {
     impl() = default;
 
-    impl(int v): value{v} {}
+    impl(int v)
+        : value{v} {}
 
-    void incr() { ++value; }
+    void incr() {
+        ++value;
+    }
 
-    void set(int v) { value = v; }
+    void set(int v) {
+        value = v;
+    }
 
-    int get() const { return value; }
+    int get() const {
+        return value;
+    }
 
-    void decrement() { --value; }
+    void decrement() {
+        --value;
+    }
 
-    double multiply(double v) const { return v * value; }
+    double multiply(double v) const {
+        return v * value;
+    }
 
     int value{};
 };
@@ -267,9 +289,9 @@ TEST(PolyDefined, Alignment) {
         cb(data, target[1].data());
     };
 
-    entt::basic_poly<Defined, alignment> nosbo[2] = { over_aligned{}, over_aligned{} };
+    entt::basic_poly<Defined, alignment> nosbo[2] = {over_aligned{}, over_aligned{}};
     test(nosbo, [](auto *pre, auto *post) { ASSERT_EQ(pre, post); });
 
-    entt::basic_poly<Defined, alignment, alignment> sbo[2] = { over_aligned{}, over_aligned{} };
+    entt::basic_poly<Defined, alignment, alignment> sbo[2] = {over_aligned{}, over_aligned{}};
     test(sbo, [](auto *pre, auto *post) { ASSERT_NE(pre, post); });
 }

+ 25 - 10
test/entt/process/process.cpp

@@ -14,24 +14,39 @@ struct fake_process: entt::process<fake_process<Delta>, Delta> {
           update_invoked{false},
           succeeded_invoked{false},
           failed_invoked{false},
-          aborted_invoked{false}
-    {}
+          aborted_invoked{false} {}
 
-    void succeed() noexcept { process_type::succeed(); }
+    void succeed() noexcept {
+        process_type::succeed();
+    }
 
-    void fail() noexcept { process_type::fail(); }
+    void fail() noexcept {
+        process_type::fail();
+    }
 
-    void pause() noexcept { process_type::pause(); }
+    void pause() noexcept {
+        process_type::pause();
+    }
 
-    void unpause() noexcept { process_type::unpause(); }
+    void unpause() noexcept {
+        process_type::unpause();
+    }
 
-    void init() { init_invoked = true; }
+    void init() {
+        init_invoked = true;
+    }
 
-    void succeeded() { succeeded_invoked = true; }
+    void succeeded() {
+        succeeded_invoked = true;
+    }
 
-    void failed() { failed_invoked = true; }
+    void failed() {
+        failed_invoked = true;
+    }
 
-    void aborted() { aborted_invoked = true; }
+    void aborted() {
+        aborted_invoked = true;
+    }
 
     void update(typename entt::process<fake_process<Delta>, Delta>::delta_type, void *data) {
         if(data) {

+ 10 - 8
test/entt/process/scheduler.cpp

@@ -1,16 +1,19 @@
 #include <functional>
 #include <gtest/gtest.h>
-#include <entt/process/scheduler.hpp>
 #include <entt/process/process.hpp>
+#include <entt/process/scheduler.hpp>
 
 struct foo_process: entt::process<foo_process, int> {
     foo_process(std::function<void()> upd, std::function<void()> abort)
-        : on_update{upd}, on_aborted{abort}
-    {}
+        : on_update{upd}, on_aborted{abort} {}
 
-    void update(delta_type, void *) { on_update(); }
+    void update(delta_type, void *) {
+        on_update();
+    }
 
-    void aborted() { on_aborted(); }
+    void aborted() {
+        on_aborted();
+    }
 
     std::function<void()> on_update;
     std::function<void()> on_aborted;
@@ -50,9 +53,8 @@ TEST(Scheduler, Functionalities) {
     ASSERT_TRUE(scheduler.empty());
 
     scheduler.attach<foo_process>(
-        [&updated](){ updated = true; },
-        [&aborted](){ aborted = true; }
-    );
+        [&updated]() { updated = true; },
+        [&aborted]() { aborted = true; });
 
     ASSERT_NE(scheduler.size(), 0u);
     ASSERT_FALSE(scheduler.empty());

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff