Răsfoiți Sursa

removed prototype and dependency (with connect/disconnect)

Michele Caini 6 ani în urmă
părinte
comite
c651392643

+ 0 - 85
src/entt/entity/helper.hpp

@@ -109,91 +109,6 @@ template<typename Entity>
 as_group(const basic_registry<Entity> &) ENTT_NOEXCEPT -> as_group<true, Entity>;
 
 
-/**
- * @brief Dependency function prototype.
- *
- * @deprecated
- * This function will be wiped out in a future version of the library.<br/>
- * Use shortcuts and cross links between registries to achieve the same result
- * in a more idiomatic way.
- *
- * A _dependency function_ is a built-in listener to use to automatically assign
- * components to an entity when a type has a dependency on some other types.
- *
- * This is a prototype function to use to create dependencies.<br/>
- * It isn't intended for direct use, although nothing forbids using it freely.
- *
- * @tparam Entity A valid entity type (see entt_traits for more details).
- * @tparam Dependency Types of components to assign to an entity if triggered.
- * @param entt A valid entity identifier.
- * @param reg A valid reference to a registry.
- */
-template<typename Entity, typename... Dependency>
-void dependency(const Entity entt, basic_registry<Entity> &reg) {
-    ((reg.template has<Dependency>(entt) ? void() : (reg.template assign<Dependency>(entt), void())), ...);
-}
-
-
-/**
- * @brief Connects a dependency function to the given sink.
- *
- * @deprecated
- * This function will be wiped out in a future version of the library.<br/>
- * Use shortcuts and cross links between registries to achieve the same result
- * in a more idiomatic way.
- *
- * A _dependency function_ is a built-in listener to use to automatically assign
- * components to an entity when a type has a dependency on some other types.
- *
- * The following adds components `a_type` and `another_type` whenever `my_type`
- * is assigned to an entity:
- * @code{.cpp}
- * entt::registry registry;
- * entt::connect<a_type, another_type>(registry.construction<my_type>());
- * @endcode
- *
- * @tparam Dependency Types of components to assign to an entity if triggered.
- * @tparam Component Type of component that triggers the dependency handler.
- * @tparam Entity A valid entity type (see entt_traits for more details).
- * @param sink A sink object properly initialized.
- */
-template<typename... Dependency, typename Component, typename Entity>
-void connect(sink<void(const Entity, basic_registry<Entity> &, Component &)> sink) {
-    constexpr auto function = &dependency<Entity, Dependency...>;
-    sink.template connect<function>();
-}
-
-
-/**
- * @brief Disconnects a dependency function from the given sink.
- *
- * @deprecated
- * This function will be wiped out in a future version of the library.<br/>
- * Use shortcuts and cross links between registries to achieve the same result
- * in a more idiomatic way.
- *
- * A _dependency function_ is a built-in listener to use to automatically assign
- * components to an entity when a type has a dependency on some other types.
- *
- * The following breaks the dependency between the component `my_type` and the
- * components `a_type` and `another_type`:
- * @code{.cpp}
- * entt::registry registry;
- * entt::disconnect<a_type, another_type>(registry.construction<my_type>());
- * @endcode
- *
- * @tparam Dependency Types of components used to create the dependency.
- * @tparam Component Type of component that triggers the dependency handler.
- * @tparam Entity A valid entity type (see entt_traits for more details).
- * @param sink A sink object properly initialized.
- */
-template<typename... Dependency, typename Component, typename Entity>
-void disconnect(sink<void(const Entity, basic_registry<Entity> &, Component &)> sink) {
-    constexpr auto function = &dependency<Entity, Dependency...>;
-    sink.template disconnect<function>();
-}
-
-
 /**
  * @brief Alias template to ease the assignment of tags to entities.
  *

+ 0 - 487
src/entt/entity/prototype.hpp

@@ -1,487 +0,0 @@
-#ifndef ENTT_ENTITY_PROTOTYPE_HPP
-#define ENTT_ENTITY_PROTOTYPE_HPP
-
-
-#include <tuple>
-#include <utility>
-#include <cstddef>
-#include <type_traits>
-#include <unordered_map>
-#include "../config/config.h"
-#include "registry.hpp"
-#include "entity.hpp"
-#include "fwd.hpp"
-
-
-namespace entt {
-
-
-/**
- * @brief Prototype container for _concepts_.
- *
- * @deprecated
- * This class will be wiped out in a future version of the library.<br/>
- * Use a prototype registry and the new `registry::stomp` functionality to
- * achieve the same result in a more idiomatic way.
- *
- * A prototype is used to define a _concept_ in terms of components.<br/>
- * Prototypes act as templates for those specific types of an application which
- * users would otherwise define through a series of component assignments to
- * entities. In other words, prototypes can be used to assign components to
- * entities of a registry at once.
- *
- * @note
- * Components used along with prototypes must be copy constructible. Prototypes
- * wrap component types with custom types, so they do not interfere with other
- * users of the registry they were built with.
- *
- * @warning
- * Prototypes directly use their underlying registries to store entities and
- * components for their purposes. Users must ensure that the lifetime of a
- * registry and its contents exceed that of the prototypes that use it.
- *
- * @tparam Entity A valid entity type (see entt_traits for more details).
- */
-template<typename Entity>
-class basic_prototype {
-    using basic_fn_type = void(const basic_prototype &, basic_registry<Entity> &, const Entity);
-
-    template<typename Component>
-    struct component_wrapper { Component component; };
-
-    struct component_handler {
-        basic_fn_type *assign_or_replace;
-        basic_fn_type *assign;
-    };
-
-    void release() {
-        if(reg->valid(entity)) {
-            reg->destroy(entity);
-        }
-    }
-
-public:
-    /*! @brief Registry type. */
-    using registry_type = basic_registry<Entity>;
-    /*! @brief Underlying entity identifier. */
-    using entity_type = Entity;
-    /*! @brief Unsigned integer type. */
-    using size_type = std::size_t;
-
-    /**
-     * @brief Constructs a prototype that is bound to a given registry.
-     * @param ref A valid reference to a registry.
-     */
-    explicit basic_prototype(registry_type &ref)
-        : reg{&ref},
-          entity{ref.create()}
-    {}
-
-    /**
-     * @brief Releases all its resources.
-     */
-    ~basic_prototype() {
-        release();
-    }
-
-    /**
-     * @brief Move constructor.
-     *
-     * After prototype move construction, instances that have been moved from
-     * are placed in a valid but unspecified state. It's highly discouraged to
-     * continue using them.
-     *
-     * @param other The instance to move from.
-     */
-    basic_prototype(basic_prototype &&other)
-        : handlers{std::move(other.handlers)},
-          reg{other.reg},
-          entity{other.entity}
-    {
-        other.entity = null;
-    }
-
-    /**
-     * @brief Move assignment operator.
-     *
-     * After prototype move assignment, instances that have been moved from are
-     * placed in a valid but unspecified state. It's highly discouraged to
-     * continue using them.
-     *
-     * @param other The instance to move from.
-     * @return This prototype.
-     */
-    basic_prototype & operator=(basic_prototype &&other) {
-        if(this != &other) {
-            auto tmp{std::move(other)};
-            handlers.swap(tmp.handlers);
-            std::swap(reg, tmp.reg);
-            std::swap(entity, tmp.entity);
-        }
-
-        return *this;
-    }
-
-    /**
-     * @brief Assigns to or replaces the given component of a prototype.
-     * @tparam Component Type of component to assign or replace.
-     * @tparam Args Types of arguments to use to construct the component.
-     * @param args Parameters to use to initialize the component.
-     * @return A reference to the newly created component.
-     */
-    template<typename Component, typename... Args>
-    Component & set(Args &&... args) {
-        component_handler handler;
-
-        handler.assign_or_replace = [](const basic_prototype &proto, registry_type &other, const Entity dst) {
-            const auto &wrapper = proto.reg->template get<component_wrapper<Component>>(proto.entity);
-            other.template assign_or_replace<Component>(dst, wrapper.component);
-        };
-
-        handler.assign = [](const basic_prototype &proto, registry_type &other, const Entity dst) {
-            if(!other.template has<Component>(dst)) {
-                const auto &wrapper = proto.reg->template get<component_wrapper<Component>>(proto.entity);
-                other.template assign<Component>(dst, wrapper.component);
-            }
-        };
-
-        handlers[reg->template type<Component>()] = handler;
-        auto &wrapper = reg->template assign_or_replace<component_wrapper<Component>>(entity, Component{std::forward<Args>(args)...});
-        return wrapper.component;
-    }
-
-    /**
-     * @brief Removes the given component from a prototype.
-     * @tparam Component Type of component to remove.
-     */
-    template<typename Component>
-    void unset() ENTT_NOEXCEPT {
-        reg->template reset<component_wrapper<Component>>(entity);
-        handlers.erase(reg->template type<Component>());
-    }
-
-    /**
-     * @brief Checks if a prototype owns all the given components.
-     * @tparam Component Components for which to perform the check.
-     * @return True if the prototype owns all the components, false otherwise.
-     */
-    template<typename... Component>
-    bool has() const ENTT_NOEXCEPT {
-        return reg->template has<component_wrapper<Component>...>(entity);
-    }
-
-    /**
-     * @brief Returns references to the given components.
-     *
-     * @warning
-     * Attempting to get a component from a prototype that doesn't own it
-     * results in undefined behavior.<br/>
-     * An assertion will abort the execution at runtime in debug mode if the
-     * prototype doesn't own an instance of the given component.
-     *
-     * @tparam Component Types of components to get.
-     * @return References to the components owned by the prototype.
-     */
-    template<typename... Component>
-    decltype(auto) get() const ENTT_NOEXCEPT {
-        if constexpr(sizeof...(Component) == 1) {
-            return (std::as_const(*reg).template get<component_wrapper<Component...>>(entity).component);
-        } else {
-            return std::tuple<std::add_const_t<Component> &...>{get<Component>()...};
-        }
-    }
-
-    /*! @copydoc get */
-    template<typename... Component>
-    decltype(auto) get() ENTT_NOEXCEPT {
-        if constexpr(sizeof...(Component) == 1) {
-            return (const_cast<Component &>(std::as_const(*this).template get<Component>()), ...);
-        } else {
-            return std::tuple<Component &...>{get<Component>()...};
-        }
-    }
-
-    /**
-     * @brief Returns pointers to the given components.
-     * @tparam Component Types of components to get.
-     * @return Pointers to the components owned by the prototype.
-     */
-    template<typename... Component>
-    auto try_get() const ENTT_NOEXCEPT {
-        if constexpr(sizeof...(Component) == 1) {
-            const auto *wrapper = reg->template try_get<component_wrapper<Component...>>(entity);
-            return wrapper ? &wrapper->component : nullptr;
-        } else {
-            return std::tuple<std::add_const_t<Component> *...>{try_get<Component>()...};
-        }
-    }
-
-    /*! @copydoc try_get */
-    template<typename... Component>
-    auto try_get() ENTT_NOEXCEPT {
-        if constexpr(sizeof...(Component) == 1) {
-            return (const_cast<Component *>(std::as_const(*this).template try_get<Component>()), ...);
-        } else {
-            return std::tuple<Component *...>{try_get<Component>()...};
-        }
-    }
-
-    /**
-     * @brief Creates a new entity using a given prototype.
-     *
-     * Utility shortcut, equivalent to the following snippet:
-     *
-     * @code{.cpp}
-     * const auto entity = registry.create();
-     * prototype(registry, entity);
-     * @endcode
-     *
-     * @note
-     * The registry may or may not be different from the one already used by
-     * the prototype. There is also an overload that directly uses the
-     * underlying registry.
-     *
-     * @param other A valid reference to a registry.
-     * @return A valid entity identifier.
-     */
-    entity_type create(registry_type &other) const {
-        const auto entt = other.create();
-        assign(other, entt);
-        return entt;
-    }
-
-    /**
-     * @brief Creates a new entity using a given prototype.
-     *
-     * Utility shortcut, equivalent to the following snippet:
-     *
-     * @code{.cpp}
-     * const auto entity = registry.create();
-     * prototype(entity);
-     * @endcode
-     *
-     * @note
-     * This overload directly uses the underlying registry as a working space.
-     * Therefore, the components of the prototype and of the entity will share
-     * the same registry.
-     *
-     * @return A valid entity identifier.
-     */
-    entity_type create() const {
-        return create(*reg);
-    }
-
-    /**
-     * @brief Assigns the components of a prototype to a given entity.
-     *
-     * Assigning a prototype to an entity won't overwrite existing components
-     * under any circumstances.<br/>
-     * In other words, only those components that the entity doesn't own yet are
-     * copied over. All the other components remain unchanged.
-     *
-     * @note
-     * The registry may or may not be different from the one already used by
-     * the prototype. There is also an overload that directly uses the
-     * underlying registry.
-     *
-     * @warning
-     * Attempting to use an invalid entity results in undefined behavior.<br/>
-     * An assertion will abort the execution at runtime in debug mode in case of
-     * invalid entity.
-     *
-     * @param other A valid reference to a registry.
-     * @param dst A valid entity identifier.
-     */
-    void assign(registry_type &other, const entity_type dst) const {
-        for(auto &handler: handlers) {
-            handler.second.assign(*this, other, dst);
-        }
-    }
-
-    /**
-     * @brief Assigns the components of a prototype to a given entity.
-     *
-     * Assigning a prototype to an entity won't overwrite existing components
-     * under any circumstances.<br/>
-     * In other words, only those components that the entity doesn't own yet are
-     * copied over. All the other components remain unchanged.
-     *
-     * @note
-     * This overload directly uses the underlying registry as a working space.
-     * Therefore, the components of the prototype and of the entity will share
-     * the same registry.
-     *
-     * @warning
-     * Attempting to use an invalid entity results in undefined behavior.<br/>
-     * An assertion will abort the execution at runtime in debug mode in case of
-     * invalid entity.
-     *
-     * @param dst A valid entity identifier.
-     */
-    void assign(const entity_type dst) const {
-        assign(*reg, dst);
-    }
-
-    /**
-     * @brief Assigns or replaces the components of a prototype for an entity.
-     *
-     * Existing components are overwritten, if any. All the other components
-     * will be copied over to the target entity.
-     *
-     * @note
-     * The registry may or may not be different from the one already used by
-     * the prototype. There is also an overload that directly uses the
-     * underlying registry.
-     *
-     * @warning
-     * Attempting to use an invalid entity results in undefined behavior.<br/>
-     * An assertion will abort the execution at runtime in debug mode in case of
-     * invalid entity.
-     *
-     * @param other A valid reference to a registry.
-     * @param dst A valid entity identifier.
-     */
-    void assign_or_replace(registry_type &other, const entity_type dst) const {
-        for(auto &handler: handlers) {
-            handler.second.assign_or_replace(*this, other, dst);
-        }
-    }
-
-    /**
-     * @brief Assigns or replaces the components of a prototype for an entity.
-     *
-     * Existing components are overwritten, if any. All the other components
-     * will be copied over to the target entity.
-     *
-     * @note
-     * This overload directly uses the underlying registry as a working space.
-     * Therefore, the components of the prototype and of the entity will share
-     * the same registry.
-     *
-     * @warning
-     * Attempting to use an invalid entity results in undefined behavior.<br/>
-     * An assertion will abort the execution at runtime in debug mode in case of
-     * invalid entity.
-     *
-     * @param dst A valid entity identifier.
-     */
-    void assign_or_replace(const entity_type dst) const {
-        assign_or_replace(*reg, dst);
-    }
-
-    /**
-     * @brief Assigns the components of a prototype to an entity.
-     *
-     * Assigning a prototype to an entity won't overwrite existing components
-     * under any circumstances.<br/>
-     * In other words, only the components that the entity doesn't own yet are
-     * copied over. All the other components remain unchanged.
-     *
-     * @note
-     * The registry may or may not be different from the one already used by
-     * the prototype. There is also an overload that directly uses the
-     * underlying registry.
-     *
-     * @warning
-     * Attempting to use an invalid entity results in undefined behavior.<br/>
-     * An assertion will abort the execution at runtime in debug mode in case of
-     * invalid entity.
-     *
-     * @param other A valid reference to a registry.
-     * @param dst A valid entity identifier.
-     */
-    void operator()(registry_type &other, const entity_type dst) const ENTT_NOEXCEPT {
-        assign(other, dst);
-    }
-
-    /**
-     * @brief Assigns the components of a prototype to an entity.
-     *
-     * Assigning a prototype to an entity won't overwrite existing components
-     * under any circumstances.<br/>
-     * In other words, only the components that the entity doesn't own yet are
-     * copied over. All the other components remain unchanged.
-     *
-     * @note
-     * This overload directly uses the underlying registry as a working space.
-     * Therefore, the components of the prototype and of the entity will share
-     * the same registry.
-     *
-     * @warning
-     * Attempting to use an invalid entity results in undefined behavior.<br/>
-     * An assertion will abort the execution at runtime in debug mode in case of
-     * invalid entity.
-     *
-     * @param dst A valid entity identifier.
-     */
-    void operator()(const entity_type dst) const ENTT_NOEXCEPT {
-        assign(*reg, dst);
-    }
-
-    /**
-     * @brief Creates a new entity using a given prototype.
-     *
-     * Utility shortcut, equivalent to the following snippet:
-     *
-     * @code{.cpp}
-     * const auto entity = registry.create();
-     * prototype(registry, entity);
-     * @endcode
-     *
-     * @note
-     * The registry may or may not be different from the one already used by
-     * the prototype. There is also an overload that directly uses the
-     * underlying registry.
-     *
-     * @param other A valid reference to a registry.
-     * @return A valid entity identifier.
-     */
-    entity_type operator()(registry_type &other) const ENTT_NOEXCEPT {
-        return create(other);
-    }
-
-    /**
-     * @brief Creates a new entity using a given prototype.
-     *
-     * Utility shortcut, equivalent to the following snippet:
-     *
-     * @code{.cpp}
-     * const auto entity = registry.create();
-     * prototype(entity);
-     * @endcode
-     *
-     * @note
-     * This overload directly uses the underlying registry as a working space.
-     * Therefore, the components of the prototype and of the entity will share
-     * the same registry.
-     *
-     * @return A valid entity identifier.
-     */
-    entity_type operator()() const ENTT_NOEXCEPT {
-        return create(*reg);
-    }
-
-    /**
-     * @brief Returns a reference to the underlying registry.
-     * @return A reference to the underlying registry.
-     */
-    const registry_type & backend() const ENTT_NOEXCEPT {
-        return *reg;
-    }
-
-    /*! @copydoc backend */
-    registry_type & backend() ENTT_NOEXCEPT {
-        return const_cast<registry_type &>(std::as_const(*this).backend());
-    }
-
-private:
-    std::unordered_map<component, component_handler> handlers;
-    registry_type *reg;
-    entity_type entity;
-};
-
-
-}
-
-
-#endif // ENTT_ENTITY_PROTOTYPE_HPP

+ 0 - 1
src/entt/entt.hpp

@@ -10,7 +10,6 @@
 #include "entity/group.hpp"
 #include "entity/helper.hpp"
 #include "entity/observer.hpp"
-#include "entity/prototype.hpp"
 #include "entity/registry.hpp"
 #include "entity/runtime_view.hpp"
 #include "entity/snapshot.hpp"

+ 0 - 1
test/CMakeLists.txt

@@ -97,7 +97,6 @@ SETUP_AND_ADD_TEST(entity entt/entity/entity.cpp)
 SETUP_AND_ADD_TEST(group entt/entity/group.cpp)
 SETUP_AND_ADD_TEST(helper entt/entity/helper.cpp)
 SETUP_AND_ADD_TEST(observer entt/entity/observer.cpp)
-SETUP_AND_ADD_TEST(prototype entt/entity/prototype.cpp)
 SETUP_AND_ADD_TEST(registry entt/entity/registry.cpp)
 SETUP_AND_ADD_TEST(runtime_view entt/entity/runtime_view.cpp)
 SETUP_AND_ADD_TEST(snapshot entt/entity/snapshot.cpp)

+ 0 - 69
test/entt/entity/helper.cpp

@@ -23,75 +23,6 @@ TEST(Helper, AsGroup) {
     ([](entt::group<entt::exclude_t<const int>, entt::get_t<const char>, const double>) {})(entt::as_group{registry});
 }
 
-TEST(Helper, Dependency) {
-    entt::registry registry;
-    const auto entity = registry.create();
-
-    ASSERT_TRUE(registry.on_construct<int>().empty());
-
-    entt::connect<double, float>(registry.on_construct<int>());
-
-    ASSERT_FALSE(registry.on_construct<int>().empty());
-    ASSERT_FALSE(registry.has<double>(entity));
-    ASSERT_FALSE(registry.has<float>(entity));
-
-    registry.assign<char>(entity);
-
-    ASSERT_FALSE(registry.has<double>(entity));
-    ASSERT_FALSE(registry.has<float>(entity));
-
-    registry.assign<int>(entity);
-
-    ASSERT_TRUE(registry.has<double>(entity));
-    ASSERT_TRUE(registry.has<float>(entity));
-    ASSERT_EQ(registry.get<double>(entity), .0);
-    ASSERT_EQ(registry.get<float>(entity), .0f);
-
-    registry.get<double>(entity) = .3;
-    registry.get<float>(entity) = .1f;
-    registry.remove<int>(entity);
-    registry.assign<int>(entity);
-
-    ASSERT_EQ(registry.get<double>(entity), .3);
-    ASSERT_EQ(registry.get<float>(entity), .1f);
-
-    registry.remove<int>(entity);
-    registry.remove<float>(entity);
-    registry.assign<int>(entity);
-
-    ASSERT_TRUE(registry.has<float>(entity));
-    ASSERT_EQ(registry.get<double>(entity), .3);
-    ASSERT_EQ(registry.get<float>(entity), .0f);
-
-    registry.remove<int>(entity);
-    registry.remove<double>(entity);
-    registry.remove<float>(entity);
-
-    ASSERT_FALSE(registry.has<int>(entity));
-    ASSERT_FALSE(registry.has<double>(entity));
-    ASSERT_FALSE(registry.has<float>(entity));
-
-    entt::disconnect<double, float>(registry.on_construct<int>());
-    registry.assign<int>(entity);
-
-    ASSERT_TRUE(registry.on_construct<int>().empty());
-    ASSERT_TRUE(registry.has<int>(entity));
-    ASSERT_FALSE(registry.has<double>(entity));
-    ASSERT_FALSE(registry.has<float>(entity));
-}
-
-TEST(Helper, DependencyWithMultipleListenersOnTheSameType) {
-    entt::registry registry;
-    entt::connect<double>(registry.on_construct<int>());
-    entt::connect<char>(registry.on_construct<int>());
-
-    const auto entity = registry.create();
-    registry.assign<int>(entity);
-
-    ASSERT_TRUE(registry.has<double>(entity));
-    ASSERT_TRUE(registry.has<char>(entity));
-}
-
 TEST(Helper, Tag) {
     entt::registry registry;
     const auto entity = registry.create();

+ 0 - 161
test/entt/entity/prototype.cpp

@@ -1,161 +0,0 @@
-#include <gtest/gtest.h>
-#include <entt/entity/prototype.hpp>
-#include <entt/entity/registry.hpp>
-
-TEST(Prototype, SameRegistry) {
-    entt::registry registry;
-    entt::prototype prototype{registry};
-
-    ASSERT_EQ(&registry, &prototype.backend());
-    ASSERT_EQ(&registry, &std::as_const(prototype).backend());
-    ASSERT_FALSE(registry.empty());
-    ASSERT_FALSE((prototype.has<int, char>()));
-
-    ASSERT_EQ(prototype.set<int>(2), 2);
-    ASSERT_EQ(prototype.set<int>(3), 3);
-    ASSERT_EQ(prototype.set<char>('c'), 'c');
-
-    ASSERT_EQ(prototype.get<int>(), 3);
-    ASSERT_EQ(std::as_const(prototype).get<char>(), 'c');
-    ASSERT_EQ(std::get<0>(prototype.get<int, char>()), 3);
-    ASSERT_EQ(std::get<1>(std::as_const(prototype).get<int, char>()), 'c');
-
-    ASSERT_NE(prototype.try_get<int>(), nullptr);
-    ASSERT_NE(prototype.try_get<char>(), nullptr);
-    ASSERT_EQ(prototype.try_get<double>(), nullptr);
-    ASSERT_EQ(*prototype.try_get<int>(), 3);
-    ASSERT_EQ(*std::as_const(prototype).try_get<char>(), 'c');
-    ASSERT_EQ(*std::get<0>(prototype.try_get<int, char, double>()), 3);
-    ASSERT_EQ(*std::get<1>(std::as_const(prototype).try_get<int, char, double>()), 'c');
-
-    const auto e0 = prototype.create();
-
-    ASSERT_TRUE((prototype.has<int, char>()));
-    ASSERT_FALSE(registry.orphan(e0));
-
-    const auto e1 = prototype();
-    prototype(e0);
-
-    ASSERT_FALSE(registry.orphan(e0));
-    ASSERT_FALSE(registry.orphan(e1));
-
-    ASSERT_TRUE((registry.has<int, char>(e0)));
-    ASSERT_TRUE((registry.has<int, char>(e1)));
-
-    registry.remove<int>(e0);
-    registry.remove<int>(e1);
-    prototype.unset<int>();
-
-    ASSERT_FALSE((prototype.has<int, char>()));
-    ASSERT_FALSE((prototype.has<int>()));
-    ASSERT_TRUE((prototype.has<char>()));
-
-    prototype(e0);
-    prototype(e1);
-
-    ASSERT_FALSE(registry.has<int>(e0));
-    ASSERT_FALSE(registry.has<int>(e1));
-
-    ASSERT_EQ(registry.get<char>(e0), 'c');
-    ASSERT_EQ(registry.get<char>(e1), 'c');
-
-    registry.get<char>(e0) = '*';
-    prototype.assign(e0);
-
-    ASSERT_EQ(registry.get<char>(e0), '*');
-
-    registry.get<char>(e1) = '*';
-    prototype.assign_or_replace(e1);
-
-    ASSERT_EQ(registry.get<char>(e1), 'c');
-}
-
-TEST(Prototype, OtherRegistry) {
-    entt::registry registry;
-    entt::registry repository;
-    entt::prototype prototype{repository};
-
-    ASSERT_TRUE(registry.empty());
-    ASSERT_FALSE((prototype.has<int, char>()));
-
-    ASSERT_EQ(prototype.set<int>(2), 2);
-    ASSERT_EQ(prototype.set<int>(3), 3);
-    ASSERT_EQ(prototype.set<char>('c'), 'c');
-
-    ASSERT_EQ(prototype.get<int>(), 3);
-    ASSERT_EQ(std::as_const(prototype).get<char>(), 'c');
-    ASSERT_EQ(std::get<0>(prototype.get<int, char>()), 3);
-    ASSERT_EQ(std::get<1>(std::as_const(prototype).get<int, char>()), 'c');
-
-    const auto e0 = prototype.create(registry);
-
-    ASSERT_TRUE((prototype.has<int, char>()));
-    ASSERT_FALSE(registry.orphan(e0));
-
-    const auto e1 = prototype(registry);
-    prototype(registry, e0);
-
-    ASSERT_FALSE(registry.orphan(e0));
-    ASSERT_FALSE(registry.orphan(e1));
-
-    ASSERT_TRUE((registry.has<int, char>(e0)));
-    ASSERT_TRUE((registry.has<int, char>(e1)));
-
-    registry.remove<int>(e0);
-    registry.remove<int>(e1);
-    prototype.unset<int>();
-
-    ASSERT_FALSE((prototype.has<int, char>()));
-    ASSERT_FALSE((prototype.has<int>()));
-    ASSERT_TRUE((prototype.has<char>()));
-
-    prototype(registry, e0);
-    prototype(registry, e1);
-
-    ASSERT_FALSE(registry.has<int>(e0));
-    ASSERT_FALSE(registry.has<int>(e1));
-
-    ASSERT_EQ(registry.get<char>(e0), 'c');
-    ASSERT_EQ(registry.get<char>(e1), 'c');
-
-    registry.get<char>(e0) = '*';
-    prototype.assign(registry, e0);
-
-    ASSERT_EQ(registry.get<char>(e0), '*');
-
-    registry.get<char>(e1) = '*';
-    prototype.assign_or_replace(registry, e1);
-
-    ASSERT_EQ(registry.get<char>(e1), 'c');
-}
-
-TEST(Prototype, RAII) {
-    entt::registry registry;
-
-    {
-        entt::prototype prototype{registry};
-        prototype.set<int>(0);
-
-        ASSERT_FALSE(registry.empty());
-    }
-
-    ASSERT_TRUE(registry.empty());
-}
-
-TEST(Prototype, MoveConstructionAssignment) {
-    entt::registry registry;
-
-    entt::prototype prototype{registry};
-    prototype.set<int>(0);
-    auto other{std::move(prototype)};
-    const auto e0 = other();
-
-    ASSERT_EQ(registry.size(), entt::registry::size_type{2});
-    ASSERT_TRUE(registry.has<int>(e0));
-
-    prototype = std::move(other);
-    const auto e1 = prototype();
-
-    ASSERT_EQ(registry.size(), entt::registry::size_type{3});
-    ASSERT_TRUE(registry.has<int>(e1));
-}