diff --git a/src/entt/entity/prototype.hpp b/src/entt/entity/prototype.hpp index c61a6b02c..761f3d24f 100644 --- a/src/entt/entity/prototype.hpp +++ b/src/entt/entity/prototype.hpp @@ -37,15 +37,15 @@ namespace entt { */ template class Prototype final { - using fn_type = void(*)(const Prototype &, Registry &, const Entity); + using basic_fn_type = void(const Prototype &, Registry &, const Entity); using component_type = typename Registry::component_type; template struct Wrapper { Component component; }; struct Handler { - fn_type accommodate; - fn_type assign; + basic_fn_type *accommodate; + basic_fn_type *assign; }; void release() { @@ -131,12 +131,12 @@ public: */ template Component & set(Args &&... args) { - fn_type accommodate = [](const Prototype &prototype, Registry &other, const Entity dst) { + basic_fn_type *accommodate = [](const Prototype &prototype, Registry &other, const Entity dst) { const auto &wrapper = prototype.registry->template get>(prototype.entity); other.template accommodate(dst, wrapper.component); }; - fn_type assign = [](const Prototype &prototype, Registry &other, const Entity dst) { + basic_fn_type *assign = [](const Prototype &prototype, Registry &other, const Entity dst) { if(!other.template has(dst)) { const auto &wrapper = prototype.registry->template get>(prototype.entity); other.template accommodate(dst, wrapper.component); diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 03611cc55..0a67a60e5 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -1471,10 +1471,10 @@ public: * @return A temporary object to use to take snasphosts. */ Snapshot snapshot() const ENTT_NOEXCEPT { - using follow_fn_type = entity_type(*)(const Registry &, const entity_type); + using follow_fn_type = entity_type(const Registry &, const entity_type); const entity_type seed = available ? (next | (entities[next] & ~traits_type::entity_mask)) : next; - follow_fn_type follow = [](const Registry ®istry, const entity_type entity) -> entity_type { + follow_fn_type *follow = [](const Registry ®istry, const entity_type entity) -> entity_type { const auto &entities = registry.entities; const auto entt = entity & traits_type::entity_mask; const auto next = entities[entt] & traits_type::entity_mask; @@ -1500,9 +1500,9 @@ public: * @return A temporary object to use to load snasphosts. */ SnapshotLoader restore() ENTT_NOEXCEPT { - using assure_fn_type = void(*)(Registry &, const entity_type, const bool); + using assure_fn_type = void(Registry &, const entity_type, const bool); - assure_fn_type assure = [](Registry ®istry, const entity_type entity, const bool destroyed) { + assure_fn_type *assure = [](Registry ®istry, const entity_type entity, const bool destroyed) { using promotion_type = std::conditional_t= sizeof(entity_type), size_type, entity_type>; // explicit promotion to avoid warnings with std::uint16_t const auto entt = promotion_type{entity} & traits_type::entity_mask; diff --git a/src/entt/entity/snapshot.hpp b/src/entt/entity/snapshot.hpp index 4b769ca75..2f7e06c54 100644 --- a/src/entt/entity/snapshot.hpp +++ b/src/entt/entity/snapshot.hpp @@ -39,9 +39,9 @@ class Snapshot final { /*! @brief A registry is allowed to create snapshots. */ friend class Registry; - using follow_fn_type = Entity(*)(const Registry &, const Entity); + using follow_fn_type = Entity(const Registry &, const Entity); - Snapshot(const Registry ®istry, Entity seed, follow_fn_type follow) ENTT_NOEXCEPT + Snapshot(const Registry ®istry, Entity seed, follow_fn_type *follow) ENTT_NOEXCEPT : registry{registry}, seed{seed}, follow{follow} @@ -243,7 +243,7 @@ public: private: const Registry ®istry; const Entity seed; - follow_fn_type follow; + follow_fn_type *follow; }; @@ -262,9 +262,9 @@ class SnapshotLoader final { /*! @brief A registry is allowed to create snapshot loaders. */ friend class Registry; - using assure_fn_type = void(*)(Registry &, const Entity, const bool); + using assure_fn_type = void(Registry &, const Entity, const bool); - SnapshotLoader(Registry ®istry, assure_fn_type assure_fn) ENTT_NOEXCEPT + SnapshotLoader(Registry ®istry, assure_fn_type *assure_fn) ENTT_NOEXCEPT : registry{registry}, assure_fn{assure_fn} { @@ -406,7 +406,7 @@ public: private: Registry ®istry; - assure_fn_type assure_fn; + assure_fn_type *assure_fn; }; diff --git a/src/entt/process/scheduler.hpp b/src/entt/process/scheduler.hpp index 27ceb882d..c7729bbe9 100644 --- a/src/entt/process/scheduler.hpp +++ b/src/entt/process/scheduler.hpp @@ -44,13 +44,13 @@ template class Scheduler final { struct ProcessHandler final { using instance_type = std::unique_ptr; - using update_type = bool(*)(ProcessHandler &, Delta, void *); - using abort_type = void(*)(ProcessHandler &, bool); + using update_fn_type = bool(ProcessHandler &, Delta, void *); + using abort_fn_type = void(ProcessHandler &, bool); using next_type = std::unique_ptr; instance_type instance; - update_type update; - abort_type abort; + update_fn_type *update; + abort_fn_type *abort; next_type next; }; diff --git a/src/entt/signal/delegate.hpp b/src/entt/signal/delegate.hpp index 53de73e82..f0328bf84 100644 --- a/src/entt/signal/delegate.hpp +++ b/src/entt/signal/delegate.hpp @@ -34,8 +34,8 @@ class Delegate; */ template class Delegate final { - using proto_type = Ret(*)(void *, Args...); - using stub_type = std::pair; + using proto_fn_type = Ret(void *, Args...); + using stub_type = std::pair; template static Ret proto(void *, Args... args) { @@ -50,7 +50,7 @@ class Delegate final { public: /*! @brief Default constructor. */ Delegate() ENTT_NOEXCEPT - : stub{std::make_pair(nullptr, proto_type{})} + : stub{} {} /** @@ -93,7 +93,7 @@ public: * After a reset, a delegate can be safely invoked with no effect. */ void reset() ENTT_NOEXCEPT { - stub = std::make_pair(nullptr, proto_type{}); + stub.second = nullptr; } /** diff --git a/src/entt/signal/sigh.hpp b/src/entt/signal/sigh.hpp index 259b3d318..8bb68bcf4 100644 --- a/src/entt/signal/sigh.hpp +++ b/src/entt/signal/sigh.hpp @@ -26,12 +26,12 @@ struct Invoker; template struct Invoker { - using proto_type = Ret(*)(void *, Args...); - using call_type = std::pair; + using proto_fn_type = Ret(void *, Args...); + using call_type = std::pair; virtual ~Invoker() = default; - bool invoke(Collector &collector, proto_type proto, void *instance, Args... args) const { + bool invoke(Collector &collector, proto_fn_type *proto, void *instance, Args... args) const { return collector(proto(instance, args...)); } }; @@ -39,12 +39,12 @@ struct Invoker { template struct Invoker { - using proto_type = void(*)(void *, Args...); - using call_type = std::pair; + using proto_fn_type = void(void *, Args...); + using call_type = std::pair; virtual ~Invoker() = default; - bool invoke(Collector &, proto_type proto, void *instance, Args... args) const { + bool invoke(Collector &, proto_fn_type *proto, void *instance, Args... args) const { return (proto(instance, args...), true); } }; @@ -132,8 +132,8 @@ class Sink final { template friend class SigH; - using proto_type = Ret(*)(void *, Args...); - using call_type = std::pair; + using proto_fn_type = Ret(void *, Args...); + using call_type = std::pair; template static Ret proto(void *, Args... args) {