Explorar el Código

EnTT v2 (#14)

EnTT v2
Michele Caini hace 8 años
padre
commit
3706fbdfee

+ 14 - 8
CMakeLists.txt

@@ -16,7 +16,7 @@ endif()
 # Project configuration
 # Project configuration
 #
 #
 
 
-project(entt VERSION 1.1.0)
+project(entt VERSION 2.0.0)
 
 
 if(NOT CMAKE_BUILD_TYPE)
 if(NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE Debug)
     set(CMAKE_BUILD_TYPE Debug)
@@ -33,7 +33,7 @@ message("* Copyright (c) 2017 ${PROJECT_AUTHOR} <${PROJECT_AUTHOR_EMAIL}>")
 message("*")
 message("*")
 
 
 #
 #
-# Compile stuff
+# Compiler stuff
 #
 #
 
 
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD 14)
@@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
 
 if(NOT MSVC)
 if(NOT MSVC)
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wconversion")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall")
     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE")
     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE")
     set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -DDEBUG")
     set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -DDEBUG")
 
 
@@ -65,15 +65,11 @@ set(PROJECT_SRC_DIR ${entt_SOURCE_DIR}/src)
 set(PROJECT_RUNTIME_OUTPUT_DIRECTORY bin)
 set(PROJECT_RUNTIME_OUTPUT_DIRECTORY bin)
 
 
 #
 #
-# Enable test support using ctest-like interface
+# Tests
 #
 #
 
 
 option(BUILD_TESTING "Enable testing with ctest." ON)
 option(BUILD_TESTING "Enable testing with ctest." ON)
 
 
-#
-# build testing stuff if required
-#
-
 if(BUILD_TESTING)
 if(BUILD_TESTING)
     set(THREADS_PREFER_PTHREAD_FLAG ON)
     set(THREADS_PREFER_PTHREAD_FLAG ON)
     find_package(Threads REQUIRED)
     find_package(Threads REQUIRED)
@@ -89,3 +85,13 @@ if(BUILD_TESTING)
     enable_testing()
     enable_testing()
     add_subdirectory(test)
     add_subdirectory(test)
 endif()
 endif()
+
+#
+# Documentation
+#
+
+find_package(Doxygen 1.8)
+
+if(DOXYGEN_FOUND)
+    add_subdirectory(docs)
+endif()

+ 473 - 302
README.md

@@ -1,19 +1,26 @@
-# EnTT - Entity-Component System in modern C++
+# The EnTT Framework
 
 
-[![Build Status](https://travis-ci.org/skypjack/entt.svg?branch=master)](https://travis-ci.org/skypjack/uvw)
+[![Build Status](https://travis-ci.org/skypjack/entt.svg?branch=master)](https://travis-ci.org/skypjack/entt)
 [![Build status](https://ci.appveyor.com/api/projects/status/rvhaabjmghg715ck?svg=true)](https://ci.appveyor.com/project/skypjack/entt)
 [![Build status](https://ci.appveyor.com/api/projects/status/rvhaabjmghg715ck?svg=true)](https://ci.appveyor.com/project/skypjack/entt)
 [![Coverage Status](https://coveralls.io/repos/github/skypjack/entt/badge.svg?branch=master)](https://coveralls.io/github/skypjack/entt?branch=master)
 [![Coverage Status](https://coveralls.io/repos/github/skypjack/entt/badge.svg?branch=master)](https://coveralls.io/github/skypjack/entt?branch=master)
 [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
 [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
 
 
 # Introduction
 # Introduction
 
 
-`EnTT` is a header-only, tiny and easy to use Entity-Component System in modern C++.<br/>
-_ECS_ is an architectural pattern used mostly in game development. For further details:
+`EnTT` is a header-only, tiny and easy to use framework written in modern
+C++.<br/>
+It's entirely designed around an architectural pattern pattern called _ECS_ that
+is used mostly in game development. For further details:
 
 
 * [Entity Systems Wiki](http://entity-systems.wikidot.com/)
 * [Entity Systems Wiki](http://entity-systems.wikidot.com/)
 * [Evolve Your Hierarchy](http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/)
 * [Evolve Your Hierarchy](http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/)
 * [ECS on Wikipedia](https://en.wikipedia.org/wiki/Entity%E2%80%93component%E2%80%93system)
 * [ECS on Wikipedia](https://en.wikipedia.org/wiki/Entity%E2%80%93component%E2%80%93system)
 
 
+Originally, `EnTT` was written as a faster alternative to other well known and
+open source entity-component systems.<br/>
+After a while the codebase has grown and more features have become part of the
+framework.
+
 ## Code Example
 ## Code Example
 
 
 ```cpp
 ```cpp
@@ -29,249 +36,274 @@ struct Velocity {
     float dy;
     float dy;
 };
 };
 
 
-using ECS = entt::DefaultRegistry<Position, Velocity>;
-
-int main() {
-    ECS ecs;
-
-    for(auto i = 0; i < 10; ++i) {
-        auto entity = ecs.create();
-        ecs.assign<Position>(entity, i * 1.f, i * 1.f);
-        if(i % 2 == 0) { ecs.assign<Velocity>(entity, i * .1f, i * .1f); }
-    }
+void update(entt::DefaultRegistry &registry) {
+    auto view = ecs.view<Position, Velocity>();
 
 
-    // single component view
-
-    for(auto entity: ecs.view<Position>()) {
-        auto &position = ecs.get<Position>(entity);
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
         // ...
         // ...
     }
     }
+}
 
 
-    // multi component view
+int main() {
+    entt::DefaultRegistry registry;
 
 
-    for(auto entity: ecs.view<Position, Velocity>()) {
-        auto &position = ecs.get<Position>(entity);
-        auto &velocity = ecs.get<Velocity>(entity);
-        // ...
+    for(auto i = 0; i < 10; ++i) {
+        auto entity = registry.create();
+        registry.assign<Position>(entity, i * 1.f, i * 1.f);
+        if(i % 2 == 0) { registry.assign<Velocity>(entity, i * .1f, i * .1f); }
     }
     }
 
 
-    ecs.reset();
+    update(registry);
+    // ...
 }
 }
 ```
 ```
 
 
 ## Motivation
 ## Motivation
 
 
-I started working on `EnTT` because of the wrong reason: my goal was to beat another well known open source _ECS_ in terms of performance.
-I did it, of course, but it wasn't much satisfying. Actually it wasn't satisfying at all. The fastest and nothing more, fairly little indeed.
-When I realized it, I tried hard to keep intact the great performance and to add all the features I want to see in my _ECS_ at the same time.
+I started working on `EnTT` because of the wrong reason: my goal was to design
+an entity-component system that beated another well known open source solution
+in terms of performance.<br/>
+I did it, of course, but it wasn't much satisfying. Actually it wasn't
+satisfying at all. The fastest and nothing more, fairly little indeed. When I
+realized it, I tried hard to keep intact the great performance of `EnTT` and to
+add all the features I wanted to see in *my* entity-component system at the same
+time.
 
 
-Today `EnTT` is finally what I was looking for: still faster than its _rivals_, a really good API and an amazing set of features.
+Today `EnTT` is finally what I was looking for: still faster than its _rivals_,
+a really good API and an amazing set of features. And even more, of course.
 
 
-### Performance
+## Performance
 
 
-As it stands right now, `EnTT` is just fast enough for my requirements if compared to my first choice (that was already amazingly fast indeed).<br/>
-Here is a comparision between the two (both of them compiled with GCC 7.2.0 on a Dell XPS 13 out of the mid 2014):
+As it stands right now, `EnTT` is just fast enough for my requirements if
+compared to my first choice (that was already amazingly fast indeed).<br/>
+Here is a comparision between the two (both of them compiled with GCC 7.2.0 on a
+Dell XPS 13 out of the mid 2014):
 
 
 | Benchmark | EntityX (experimental/compile_time) | EnTT |
 | Benchmark | EntityX (experimental/compile_time) | EnTT |
 |-----------|-------------|-------------|
 |-----------|-------------|-------------|
-| Creating 10M entities | 0.177225s | **0.0881921s** |
-| Destroying 10M entities | 0.066419s | **0.0552661s** |
-| Iterating over 10M entities, unpacking one component | 0.0104935s | **8.8e-08s** |
-| Iterating over 10M entities, unpacking two components | 0.00835546s | **0.00323798s** |
-| Iterating over 10M entities, unpacking two components, half of the entities have all the components | 0.00772169s | **0.00162265s** |
-| Iterating over 10M entities, unpacking two components, one of the entities has all the components | 0.00751099s | **5.17e-07s** |
-| Iterating over 10M entities, unpacking five components | 0.00863762s | **0.00323384s** |
-| Iterating over 10M entities, unpacking ten components | 0.0105657s | **0.00323742s** |
-| Iterating over 10M entities, unpacking ten components, half of the entities have all the components | 0.00880251s | **0.00164593s** |
-| Iterating over 10M entities, unpacking ten components, one of the entities has all the components | 0.0067667s | **5.38e-07s** |
-| Iterating over 50M entities, unpacking one component | 0.0530271s | **7.7e-08s** |
-| Iterating over 50M entities, unpacking two components | 0.056233s | **0.0161715s** |
-
-`EnTT` includes its own tests and benchmarks. See [benchmark.cpp](https://github.com/skypjack/entt/blob/master/test/benchmark.cpp) for further details.<br/>
-On Github users can find also a [benchmark suite](https://github.com/abeimler/ecs_benchmark) that compares a bunch of different projects, one of which is `EnTT`.
-
-Of course, probably I'll try to get out of `EnTT` more features and better performance in the future, mainly for fun.<br/>
-If you want to contribute and/or have any suggestion, feel free to make a PR or open an issue to discuss your idea.
+| Creating 10M entities | 0.128881s | **0.0408754s** |
+| Destroying 10M entities | **0.0531374s** | 0.0545839s |
+| Iterating over 10M entities, unpacking one component, standard view | 0.010661s | **1.58e-07s** |
+| Iterating over 10M entities, unpacking two components, standard view | **0.0112664s** | 0.0840068s |
+| Iterating over 10M entities, unpacking two components, standard view, half of the entities have all the components | **0.0077951s** | 0.042168s |
+| Iterating over 10M entities, unpacking two components, standard view, one of the entities has all the components | 0.00713398s | **8.93e-07s** |
+| Iterating over 10M entities, unpacking two components, persistent view | 0.0112664s | **5.68e-07s** |
+| Iterating over 10M entities, unpacking five components, standard view | **0.00905084s** | 0.137757s |
+| Iterating over 10M entities, unpacking five components, persistent view | 0.00905084s | **2.9e-07s** |
+| Iterating over 10M entities, unpacking ten components, standard view | **0.0104708s** | 0.388602s |
+| Iterating over 10M entities, unpacking ten components, standard view, half of the entities have all the components | **0.00899859s** | 0.200752s |
+| Iterating over 10M entities, unpacking ten components, standard view, one of the entities has all the components | 0.00700349s | **2.565e-06s** |
+| Iterating over 10M entities, unpacking ten components, persistent view | 0.0104708s | **6.23e-07s** |
+| Iterating over 50M entities, unpacking one component, standard view | 0.055194s | **2.87e-07s** |
+| Iterating over 50M entities, unpacking two components, standard view | **0.0533921s** | 0.243197s |
+| Iterating over 50M entities, unpacking two components, persistent view | 0.055194s | **4.47e-07s** |
+| Sort 150k entities, one component | - | **0.0080046s** |
+| Sort 150k entities, match two components | - | **0.00608322s** |
+
+`EnTT` includes its own tests and benchmarks. See
+[benchmark.cpp](https://github.com/skypjack/entt/blob/master/test/benchmark.cpp)
+for further details.<br/>
+On Github users can find also a
+[benchmark suite](https://github.com/abeimler/ecs_benchmark) that compares a
+bunch of different projects, one of which is `EnTT`.
+
+Of course, probably I'll try to get out of `EnTT` more features and better
+performance in the future, mainly for fun.<br/>
+If you want to contribute and/or have any suggestion, feel free to make a PR or
+open an issue to discuss your idea.
 
 
 # Build Instructions
 # Build Instructions
 
 
 ## Requirements
 ## Requirements
 
 
-To be able to use `EnTT`, users must provide a full-featured compiler that supports at least C++14.<br/>
-CMake version 3.2 or later is mandatory to compile the tests, users don't have to install it otherwise.
+To be able to use `EnTT`, users must provide a full-featured compiler that
+supports at least C++14.<br/>
+The requirements below are mandatory to compile the tests and to extract the
+documentation:
+
+* CMake version 3.2 or later.
+* Doxygen version 1.8 or later.
 
 
 ## Library
 ## Library
 
 
-`EnTT` is a header-only library. This means that including the `registry.hpp` header is enough to use it.<br/>
-It's a matter of adding the following line at the top of a file:
+`EnTT` is a header-only library. This means that including the `entt.hpp`
+header is enough to include the whole framework and use it. For those who are
+interested only in the entity-component system, consider to include the sole
+`entity/registry.hpp` header instead.<br/>
+It's a matter of adding the following line to the top of a file:
 
 
 ```cpp
 ```cpp
-#include <registry.hpp>
+#include <entt/entt.hpp>
 ```
 ```
 
 
-Then pass the proper `-I` argument to the compiler to add the `src` directory to the include paths.
-
-## Documentation
+Use the line below to include only the entity-component system instead:
 
 
-### API Reference
-
-Unfortunately `EnTT` isn't documented yet and thus users cannot rely on in-code documentation.<br/>
-Source code and names are self-documenting and I'm pretty sure that a glimpse to the API is enough for most of the users.<br/>
-For all the others, below is a crash course that guides them through the project and tries to fill the gap.
+```cpp
+#include <entt/entity/registry.hpp>
+```
 
 
-### Crash Course
+Then pass the proper `-I` argument to the compiler to add the `src` directory to
+the include paths.
 
 
-`EnTT` has two main actors: the **Registry** and the **View**.<br/>
-The former can be used to manage components, entities and collections of components and entities. The latter allows users to iterate the underlying collections.
+## Documentation
 
 
-#### The Registry
+The documentation is based on [doxygen](http://www.stack.nl/~dimitri/doxygen/).
+To build it:
 
 
-There are two options to instantiate a registry:
+    $ cd build
+    $ cmake ..
+    $ make docs
 
 
-* Use the `DefaultRegistry` alias:
+The API reference will be created in HTML format within the directory
+`build/docs/html`. To navigate it with your favorite browser:
 
 
-    ```cpp
-    auto registry = entt::DefaultRegistry<Components...>{args...};
-    ```
+    $ cd build
+    $ your_favorite_browser docs/html/index.html
 
 
-  Users must provide the whole list of components to be registered with the default registry and that's all.
+The API reference is also available [online](https://skypjack.github.io/entt/)
+for the latest version.
 
 
-* Use directly the `Registry` class template:
+## Tests
 
 
-    ```cpp
-    auto registry = entt::Registry<std::uint16_t, Components...>{args...};
-    ```
+To compile and run the tests, `EnTT` requires *googletest*.<br/>
+`cmake` will download and compile the library before to compile anything else.
 
 
-  Users must provide the whole list of components to be registered with the registry **and** the desired type for the entities.
-  Note that the default type (the one used by the default registry) is `std::uint32_t`, that is larger enough for almost all the games but also too big for the most of the games.
+To build the tests:
 
 
-In both cases there are no requirements for the components but to be moveable, therefore POD types are just fine.
+* `$ cd build`
+* `$ cmake ..`
+* `$ make`
+* `$ make test`
 
 
-The `Registry` class offers a bunch of basic functionalities to query the internal data structures.
-In almost all the cases those member functions can be used to query either the entity list or the components lists.<br/>
-As an example, the member functions `empty` can be used to know if at least an entity exists and/or if at least one component of the given type has been assigned to an entity.<br/>
+To build the benchmarks, use the following line instead:
 
 
-```cpp
-bool b = registry.empty();
-// ...
-bool b = registry.empty<MyComponent>();
-```
+* `$ cmake -DCMAKE_BUILD_TYPE=Release ..`
 
 
-Similarly, `size` can be used to know the number of entities alive and/or the number of components of a given type still assigned to entities. `capacity` follows the same pattern and returns the storage capacity for the given element.
+Benchmarks are compiled only in release mode currently.
 
 
-The `valid` member function returns true if `entity` is still in use, false otherwise:
+# Crash Course
+
+## Vademecum
+
+The `Registry` to store, the `View`s to iterate. That's all.
+
+An entity (the _E_ of an _ECS_) is an opaque identifier that users should just
+use as-is and store around if needed. Do not try to inspect an entity
+identifier, its type can change in future and a registry offers all the
+functionalities to query them out-of-the-box. The underlying type of an entity
+(either `std::uint16_t`, `std::uint32_t` or `std::uint64_t`) can be specified
+when defining a registry (actually the DefaultRegistry is nothing more than a
+Registry where the type of the entities is `std::uint32_t`).<br/>
+Components (the _C_ of an _ECS_) should be plain old data structures or more
+complex and moveable data structures with a proper constructor. They are list
+initialized by using the parameters provided to construct the component. No need
+to register components or their types neither with the registry nor with the
+entity-component system at all.<br/>
+Systems (the _S_ of an _ECS_) are just plain functions, functors, lambdas or
+whatever the users want. They can accept a Registry, a View or a PersistentView
+and use them the way they prefer. No need to register systems or their types
+neither with the registry nor with the entity-component system at all.
+
+The following sections will explain in short how to use the entity-component
+system, the core part of the `EnTT` framework.<br/>
+In fact, the framework is composed of many other classes in addition to those
+describe below. For more details, please refer to the
+[online documentation](https://skypjack.github.io/entt/).
+
+## The Registry, the Entity and the Component
+
+A registry is used to store and manage entities as well as to create views to
+iterate the underlying data structures.<br/>
+Registry is a class template that lets the users decide what's the preferred
+type to represent an entity. Because `std::uint32_t` is large enough for almost
+all the cases, there exists also an alias named DefaultRegistry for
+`Registry<std::uint32_t>`.
+
+Entities are represented by _entitiy identifiers_. An entity identifier is an
+opaque type that users should not inspect or modify in any way. It carries
+information about the entity itself and its version.
+
+A registry can be used both to construct and to destroy entities:
 
 
 ```cpp
 ```cpp
-bool b = registry.valid(entity);
-```
-
-Boring, I agree. Let's go to something more tasty.
-The following functionalities are meant to give users the chance to play with entities and components within a registry.
-
-The `create` member function can be used to construct a new entity and it comes in two flavors:
-
-* The plain version just creates a _naked_ entity with no components assigned to it:
-
-    ```cpp
-    auto entity = registry.create();
-    ```
+// constructs a naked entity with no components ad returns its identifier
+auto entity = registry.create();
 
 
-* The member function template creates an entity and assigns to it the given _default-initialized_ components:
+// constructs an entity and assigns it default-initialized components
+auto another = registry.create<Position, Velocity>();
 
 
-    ```cpp
-    auto entity = registry.create<Position, Velocity>();
-    ```
-
-  It's a helper function, mostly syncactic sugar and it's equivalent to the following snippet:
-
-    ```cpp
-    auto entity = registry.create();
-    registry.assign<Position>();
-    registry.assign<Velocity>();
-    ```
-
-  See below to find more about the `assign` member function.
-
-On the other side, the `destroy` member function can be used to delete an entity and all its components (if any):
-
-```cpp
+// destroys an entity and all its components
 registry.destroy(entity);
 registry.destroy(entity);
 ```
 ```
 
 
-It requires that `entity` is valid. In case it is not, an assertion will fail in debug mode and the behaviour is undefined in release mode.
-
-If the purpose is to remove a single component instead, the `remove` member function template is the way to go:
+Once an entity is deleted, the registry can freely reuse it internally with a
+slightly different identifier. In particular, the version of an entity is
+increased each and every time it's destroyed.<br/>
+In case entity identifiers are stored around, the registry offers all the
+functionalities required to test them and get out of the them all the
+information they carry:
 
 
 ```cpp
 ```cpp
-registry.remove<Position>(entity);
-```
-
-Again, it requires that `entity` is valid. Moreover, an instance of the component must have been previously assigned to the entity.
-If one of the requirements isn't satisfied, an assertion will fail in debug mode and the behaviour is undefined in release mode.
+// returns true if the entity is still valid, false otherwise
+bool b = registry.valid(entity);
 
 
-The `reset` member function behaves similarly but with a strictly defined behaviour (and a performance penalty is the price to pay for that). In particular it removes the component if and only if it exists, otherwise it returns safely to the caller:
+// gets the version contained in the entity identifier
+auto version = registry.version(entity);
 
 
-```cpp
-registry.reset<Position>(entity);
+// gets the actual version for the given entity
+auto curr = registry.current(entity);
 ```
 ```
 
 
-It requires only that `entity` is valid. In case it is not, an assertion will fail in debug mode and the behaviour is undefined in release mode.
-
-There exist also two more _versions_ of the `reset` member function:
-
-* If no entity is passed to it, `reset` will remove the given component from each entity that has it:
-
-    ```cpp
-    registry.reset<Position>();
-    ```
+Components can be assigned to or removed from entities at any time with a few
+calls to member functions of the registry. As for the entities, the registry
+offers also a set of functionalities users can use to work with the components.
 
 
-* If neither the entity nor the component are specified, all the entities and their components are destroyed:
-
-    ```cpp
-    registry.reset();
-    ```
-
-  **Note**: the registry has an assert in debug mode that verifies that entities are no longer valid when it's destructed. This function can be used to reset the registry to its initial state and thus to satisfy the requirement.
-
-To assign a component to an entity, users can rely on the `assign` member function template. It accepts a variable number of arguments that are used to construct the component itself if present:
+The `assign` member function template creates, initializes and assigns to an
+entity the given component. It accepts a variable number of arguments that are
+used to construct the component itself if present:
 
 
 ```cpp
 ```cpp
 registry.assign<Position>(entity, 0., 0.);
 registry.assign<Position>(entity, 0., 0.);
+
 // ...
 // ...
+
 auto &velocity = registry.assign<Velocity>(entity);
 auto &velocity = registry.assign<Velocity>(entity);
 velocity.dx = 0.;
 velocity.dx = 0.;
 velocity.dy = 0.;
 velocity.dy = 0.;
 ```
 ```
 
 
-It requires that `entity` is valid. Moreover, the entity shouldn't have another instance of the component assigned to it.
-If one of the requirements isn't satisfied, an assertion will fail in debug mode and the behaviour is undefined in release mode.
-
-If the entity already has the given component and the user wants to replace it, the `replace` member function template is the way to go:
+If the entity already has the given component, the `replace` member function
+template can be used to replace it:
 
 
 ```cpp
 ```cpp
 registry.replace<Position>(entity, 0., 0.);
 registry.replace<Position>(entity, 0., 0.);
+
 // ...
 // ...
+
 auto &velocity = registry.replace<Velocity>(entity);
 auto &velocity = registry.replace<Velocity>(entity);
 velocity.dx = 0.;
 velocity.dx = 0.;
 velocity.dy = 0.;
 velocity.dy = 0.;
 ```
 ```
 
 
-It requires that `entity` is valid. Moreover, an instance of the component must have been previously assigned to the entity.
-If one of the requirements isn't satisfied, an assertion will fail in debug mode and the behaviour is undefined in release mode.
-
-In case users want to assign a component to an entity, but it's unknown whether the entity already has it or not, `accomodate` does the work in a single call
-(of course, there is a performance penalty to pay for that mainly due to the fact that it must check if `entity` already has the given component or not):
+In case users want to assign a component to an entity, but it's unknown whether
+the entity already has it or not, `accomodate` does the work in a single call
+(of course, there is a performance penalty to pay for that mainly due to the
+fact that it must check if `entity` already has the given component or not):
 
 
 ```cpp
 ```cpp
 registry.accomodate<Position>(entity, 0., 0.);
 registry.accomodate<Position>(entity, 0., 0.);
+
 // ...
 // ...
+
 auto &velocity = registry.accomodate<Velocity>(entity);
 auto &velocity = registry.accomodate<Velocity>(entity);
 velocity.dx = 0.;
 velocity.dx = 0.;
 velocity.dy = 0.;
 velocity.dy = 0.;
 ```
 ```
 
 
-It requires only that `entity` is valid. In case it is not, an assertion will fail in debug mode and the behaviour is undefined in release mode.<br/>
-Note that `accomodate` is a sliglhty faster alternative for the following if/else statement and nothing more:
+Note that `accomodate` is a sliglhty faster alternative for the following
+`if`/`else` statement and nothing more:
 
 
 ```cpp
 ```cpp
 if(registry.has<Comp>(entity)) {
 if(registry.has<Comp>(entity)) {
@@ -281,217 +313,356 @@ if(registry.has<Comp>(entity)) {
 }
 }
 ```
 ```
 
 
-As already shown, if in doubt about whether or not an entity has one or more components, the `has` member function template may be useful:
+As already shown, if in doubt about whether or not an entity has one or more
+components, the `has` member function template may be useful:
 
 
 ```cpp
 ```cpp
 bool b = registry.has<Position, Velocity>(entity);
 bool b = registry.has<Position, Velocity>(entity);
 ```
 ```
 
 
-It requires only that `entity` is valid. In case it is not, an assertion will fail in debug mode and the behaviour is undefined in release mode.
-
-Entities can also be cloned and either partially or fully copied:
+On the other side, if the goal is to delete a single component, the `remove`
+member function template is the way to go when it's certain that the entity owns
+a copy of the component:
 
 
 ```cpp
 ```cpp
-auto entity = registry.clone(other);
-// ...
-auto &velocity = registry.copy<Velocity>(to, from);
-// ...
-registry.copy(dst, src);
+registry.remove<Position>(entity);
 ```
 ```
 
 
-In particular:
-
-* The `clone` member function creates a new entity and copy all the components from the given one.
-* The `copy` member function template copies one component from an entity to another one.
-* The `copy` member function copies all the components from an entity to another one.
-
-All the functions above mentioned require that entities provided as arguments are valid and components exist wherever they have to be accessed.
-In case they are not, an assertion will fail in debug mode and the behaviour is undefined in release mode.
-
-There exists also an utility member function that can be used to `swap` components between entities:
+Otherwise consider to use the `reset` member function. It behaves similarly to
+`remove` but with a strictly defined behaviour (and a performance penalty is the
+price to pay for that). In particular it removes the component if and only if it
+exists, otherwise it returns safely to the caller:
 
 
 ```cpp
 ```cpp
-registry.swap<Position>(e1, e2);
+registry.reset<Position>(entity);
 ```
 ```
 
 
-As usual, it requires that the two entities are valid and that two instances of the component have been previously assigned to them.
-In case they are not, an assertion will fail in debug mode and the behaviour is undefined in release mode.
+There exist also two other _versions_ of the `reset` member function:
 
 
-The `get` member function template (either the non-const or the const version) gives direct access to the component of an entity instead:
-
-```cpp
-auto &position = registry.get<Position>(entity);
-```
+* If no entity is passed to it, `reset` will remove the given component from
+each entity that has it:
 
 
-It requires that `entity` is valid. Moreover, an instance of the component must have been previously assigned to the entity.
-If one of the requirements isn't satisfied, an assertion will fail in debug mode and the behaviour is undefined in release mode.
+  ```cpp
+  registry.reset<Position>();
+  ```
 
 
-Components can also be sorted in memory by means of the `sort` member function templates. In particular:
+* If neither the entity nor the component are specified, all the entities and
+their components are destroyed:
 
 
-* Components can be sorted according to a component:
+  ```cpp
+  registry.reset();
+  ```
 
 
-    ```cpp
-    registry.sort<Renderable>([](const auto &lhs, const auto &rhs) { return lhs.z < rhs.z; });
-    ```
+Finally, references to components can be retrieved by just doing this:
 
 
-* Components can be sorted according to the order imposed by another component:
+```cpp
+// either a non-const reference ...
+DefaultRegistry registry;
+auto &position = registry.get<Position>(entity);
 
 
-    ```cpp
-    registry.sort<Movement, Physics>();
-    ```
+// ... or a const one
+const auto &cregistry = registry;
+const auto &position = cregistry.get<Position>(entity);
+```
 
 
-  In this case, instances of `Movement` are arranged in memory so that cache misses are minimized when the two components are iterated together.
+The `get` member function template gives direct access to the component of an
+entity stored in the underlying data structures of the registry.
 
 
-Finally, the `view` member function template returns an iterable portion of entities and components:
+### Sorting: is it possible?
 
 
-```cpp
-auto view = registry.view<Position, Velocity>();
-```
+Of course, sorting entities and components is possible with `EnTT`.<br/>
+In fact, there are two functions that respond to slightly different needs:
 
 
-Views are the other core component of `EnTT` and are usually extensively used by softwares that include it. See below for more details about the types of views.
+* Components can be sorted directly:
 
 
-#### The View
+  ```cpp
+  registry.sort<Renderable>([](const auto &lhs, const auto &rhs) {
+      return lhs.z < rhs.z;
+  });
+  ```
 
 
-There are two types of views:
+* Components can be sorted according to the order imposed by another component:
 
 
-* **Single component view**.
+  ```cpp
+  registry.sort<Movement, Physics>();
+  ```
+
+  In this case, instances of `Movement` are arranged in memory so that cache
+  misses are minimized when the two components are iterated together.
+
+## View: to persist or not to persist?
+
+There are mainly two kinds of views: standard (also known as View) and
+persistent (alsa known as PersistentView).<br/>
+Both of them have pros and cons to take in consideration. In particular:
+
+* Standard views:
+
+  Pros:
+  * They work out-of-the-box and don't require any dedicated data
+    structure.
+  * Creating and destroying them isn't expensive at all because they don't
+    have any type of initialization.
+  * They are the best tool to iterate single components.
+  * They are the best tool to iterate multiple components at once when
+    tags are involved or one of the component is assigned to a
+    significantly low number of entities.
+  * They don't affect any other operations of the registry.
+
+  Cons:
+  * Their performance tend to degenerate when the number of components
+    to iterate grows up and the most of the entities have all of them.
+
+* Persistent views:
+
+  Pros:
+  * Once prepared, creating and destroying them isn't expensive at all
+    because they don't have any type of initialization.
+  * They are the best tool to iterate multiple components at once when
+    the most of the entities have all of them.
+
+  Cons:
+    * They have dedicated data structures and thus affect the memory
+      pressure to a minimal extent.
+    * If not previously prepared, the first time they are used they go
+      through an initialization step that could take a while.
+    * They affect to a minimum the creation and destruction of entities and
+      components. In other terms: the more persistent views there will be,
+      the less performing will be creating and destroying entities and
+      components.
+
+To sum up and as a rule of thumb, use a standard view:
+* To iterate entities for a single component.
+* To iterate entities for multiple components when a significantly low
+  number of entities have one of the components.
+* In all those cases where a persistent view would give a boost to
+  performance but the iteration isn't performed frequently.
+
+Use a persistent view in all the other cases.
+
+To easily iterate entities, all the views offer _C++-ish_ `begin` and `end`
+member functions that allow users to use them in a typical range-for loop.<br/>
+Continue reading for more details or refer to the
+[official documentation](https://skypjack.github.io/entt/).
+
+### Standard View
+
+A standard view behaves differently if it's constructed for a single component
+or if it has been requested to iterate multiple components. Even the API is
+different in the two cases.<br/>
+All that they share is the way they are created by means of a registry:
 
 
-  A single component view gives direct access to both the components and the entities to which the components are assigned.<br/>
-  This kind of views are created from the `Registry` class by means of the `view` member function template as it follows:
+```cpp
+// single component standard view
+auto single = registry.view<Position>();
 
 
-    ```cpp
-    // Actual type is Registry<Components...>::view_type<Comp>, where Comp is the component for which the view should be created ...
-    // ... well, auto is far easier to use in this case, isn't it?
-    auto view = registry.view<Sprite>();
-    ```
+// multi component standard view
+auto multi = registry.view<Position, Velocity>();
+```
 
 
-  Components and entities are stored in tightly packed arrays and single component views are the fastest solution to iterate them.<br/>
-  They have the _C++11-ish_ `begin` and `end` member function that allow users to use them in a typical range-for loop:
+For all that remains, it's worth discussing them separately.<br/>
 
 
-    ```cpp
-    auto view = registry.view<Sprite>();
+#### Single component standard view
 
 
-    for(auto entity: view) {
-        auto &sprite = registry.get<Sprite>(entity);
-        // ...
-    }
-    ```
+Single component standard views are specialized in order to give a boost in
+terms of performance in all the situation. This kind of views can access the
+underlying data structures directly and avoid superflous checks.<br/>
+They offer a bunch of functionalities to get the number of entities they are
+going to return and a raw access to the entity list as well as to the component
+list.<br/>
+Refer to the [official documentation](https://skypjack.github.io/entt/) for all
+the details.
 
 
-  Iterating a view this way returns entities that can be further used to get components or perform other activities.<br/>
-  There is also another method one can use to iterate the array of entities, that is by using the `size` and `data` member functions:
+There is no need to store views around for they are extremely cheap to
+construct, even though they can be copied without problems and reused
+freely. In fact, they return newly created and correctly initialized iterators
+whenever `begin` or `end` are invoked.<br/>
+To iterate a single component standard view, just use it in range-for:
 
 
-    ```cpp
-    auto view = registry.view<Sprite>();
-    const auto *data = view.data();
+```cpp
+auto view = registry.view<Renderable>();
 
 
-    for(auto i = 0, end = view.size(); i < end; ++i) {
-        auto entity = *(data + i);
-        // ...
-    }
-    ```
+for(auto entity: view) {
+    auto &renderable = view.get(entity);
 
 
-  Entites are good when the sole component isn't enough to perform a task.
-  Anyway they come with a cost: accessing components by entities has an extra level of indirection. It's pretty fast, but not that fast in some cases.<br/>
-  Direct access to the packed array of components is the other option around of a single component view. Member functions `size` and `raw` are there for that:
+    // ...
+}
+```
 
 
-    ```cpp
-    auto view = registry.view<Sprite>();
-    const auto *raw = view.raw();
+**Note**: prefer the `get` member function of the view instead of the `get`
+member function template of the registry during iterations.
 
 
-    for(auto i = 0, end = view.size(); i < end; ++i) {
-        auto &sprite = *(raw + i);
-        // ...
-    }
-    ```
+#### Multi component standard view
 
 
-  This is the fastest solution to iterate over the components: they are packed together by construction and visit them in order will reduce to a minimum the number of cache misses.
+Multi component standard views iterate entities that have at least all the given
+components in their bags. During construction, these views look at the number
+of entities available for each component and pick up a reference to the smallest
+set of candidates in order to speed up iterations.<br/>
+They offer fewer functionalities than their companion views for single
+component, the most important of which can be used to reset the view and refresh
+the reference to the set of candidate entities to iterate.<br/>
+Refer to the [official documentation](https://skypjack.github.io/entt/) for all
+the details.
 
 
-* **Multi component view**.
+There is no need to store views around for they are extremely cheap to
+construct, even though they can be copied without problems and reused
+freely. In fact, they return newly created and correctly initialized iterators
+whenever `begin` or `end` are invoked.<br/>
+To iterate a multi component standard view, just use it in range-for:
 
 
-  A multi component view gives access only to the entities to which the components are assigned.<br/>
-  This kind of views are created from the `Registry` class by means of the `view` member function template as it follows:
+```cpp
+auto view = registry.view<Position, Velocity>();
 
 
-    ```cpp
-    // Actual type is Registry<Components...>::view_type<Comp...>, where Comp... are the components for which the view should be created ...
-    // ... well, auto is far easier to use in this case, isn't it?
-    auto view = registry.view<Position, Velocity>();
-    ```
+for(auto entity: view) {
+    auto &position = view.get<Position>(entity);
+    auto &velocity = view.get<Velocity>(entity);
 
 
-  Multi component views can be iterated by means of the `begin` and `end` member functions in a typical range-for loop:
+    // ...
+}
+```
 
 
-    ```cpp
-    auto view = registry.view<Position, Velocity>();
+**Note**: prefer the `get` member function template of the view instead of the
+`get` member function template of the registry during iterations.
 
 
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        // ...
-    }
-    ```
+### Persistent View
 
 
-  Note that there exists a packed array of entities to which the component is assigned for each component.
-  Iterators of a multi component view pick the shortest array up and use it to visit the smallest set of potential entities.<br/>
-  The choice is performed when the view is constructed. It's good enough as long as views are discarded once they have been used.
-  For all the other cases, the `reset` member function can be used whenever the data within the registry are known to be changed and forcing the choice again could speed up the execution.
+A persistent view returns all the entities and only the entities that have at
+least the given components. Moreover, it's guaranteed that the entity list is
+thightly packed in memory for fast iterations.<br/>
+In general, persistent views don't stay true to the order of any set of
+components unless users explicitly sort them.
 
 
-  **Note**: one could argue that an iterator should return the set of references to components for each entity instead of the entity itself.
-  Well, who wants to spend CPU cycles to get a reference to an useless tag component? This drove the design choice indeed.
+Persistent views can be used only to iterate multiple components. Create them
+as it follows:
 
 
-All the views can be used more than once. They return newly created and correctly initialized iterators whenever `begin` or `end` is invoked.
-The same is valid for `data` and `raw` too. Anyway views and iterators are tiny objects and the time spent to construct them can be safely ignored.<br/>
-I'd suggest not to store them anywhere and to invoke the `Registry::view` member function template at each iteration to get a properly initialized view through which to iterate.
+```cpp
+auto view = registry.persistent<Position, Velocity>();
+```
 
 
-#### Side notes
+There is no need to store views around for they are extremely cheap to
+construct, even though they can be copied without problems and reused
+freely. In fact, they return newly created and correctly initialized iterators
+whenever `begin` or `end` are invoked.<br/>
+That being said, persistent views perform an initialization step the very first
+time they are constructed and this could be quite costly. To avoid it, consider
+asking to the registry to _prepare_ them when no entities have been created yet:
 
 
-* Entities are numbers and nothing more. They are not classes and they have no member functions at all.
+```cpp
+registry.prepare<Position, Velocity>();
+```
 
 
-* Most of the _ECS_ available out there have an annoying limitation (at least from my point of view): entities and components cannot be created, assigned or deleted while users are iterating on them.<br/>
-  `EnTT` partially solves the problem with a few limitations:
+If the registry is empty, preparation is extremely fast. Moreover the `prepare`
+member function template is idempotent. Feel free to invoke it even more than
+once: if the view has been alreadt prepared before, the function returns
+immediately and does nothing.
 
 
-    * Entities can be created at any time while iterating one or more components.
-    * Components can be assigned to any entity at any time while iterating one or more components.
-    * During an iteration, the current entity (that is the one returned by the iterator) can be deleted and all its components can be removed safely.
+A persistent view offers a bunch of functionalities to get the number of
+entities it's going to return, a raw access to the entity list and the
+possibility to sort the underlying data structures according to the order of one
+of the components for which it has been constructed.<br/>
+Refer to the [official documentation](https://skypjack.github.io/entt/) for all
+the details.
 
 
-  Entities that are not the current one (that is the one returned by the iterator) cannot be deleted from within a loop.<br/>
-  Components assigned to entities that are not the current one (that is the one returned by the iterator) cannot be removed from within a loop.<br/>
-  In this case, iterators are invalidated and the behaviour is undefined if one continues to use those iterators. Possible approaches are:
+To iterate a persistent view, just use it in range-for:
 
 
-    * Store aside the entities and components to be removed and perform the operations at the end of the iteration.
-    * Mark entities and components with a proper tag component that indicates that they must be purged, then perform a second iteration to clean them up one by one.
+```cpp
+auto view = registry.persistent<Position, Velocity>();
 
 
-* Iterators aren't thread safe. Do no try to iterate over a set of components and modify them concurrently.<br/>
-  That being said, as long as a thread iterates over the entities that have the component `X` or assign and removes that component from a set of entities and another thread does something similar with components `Y` and `Z`, it shouldn't be a problem at all.<br/>
-  As an example, that means that users can freely run the rendering system over the renderable entities and update the physics concurrently on a separate thread if needed.
+for(auto entity: view) {
+    auto &position = view.get<Position>(entity);
+    auto &velocity = view.get<Velocity>(entity);
 
 
-## Tests
+    // ...
+}
+```
 
 
-To compile and run the tests, `EnTT` requires *googletest*.<br/>
-`cmake` will download and compile the library before to compile anything else.
+**Note**: prefer the `get` member function template of the view instead of the
+`get` member function template of the registry during iterations.
 
 
-Then, to build the tests:
+## Side notes
 
 
-* `$ cd build`
-* `$ cmake ..`
-* `$ make`
-* `$ make test`
+* Entity identifiers are numbers and nothing more. They are not classes and they
+  have no member functions at all. As already mentioned, do no try to inspect or
+  modify an entity descriptor in any way.
 
 
-To build the benchmarks, use the following line instead:
+* As shown in the examples above, the preferred way to get references to the
+  components while iterating a view is by using the view itself. It's a faster
+  alternative to the `get` member function template that is part of the API of
+  the Registry. That's because the registry must ensure that a pool for the
+  given component exists before to use it; on the other side, views force the
+  construction of the pools for all their components and access them directly,
+  thus avoiding all the checks.
 
 
-* `$ cmake -DCMAKE_BUILD_TYPE=Release ..`
+* Most of the _ECS_ available out there have an annoying limitation (at least
+  from my point of view): entities and components cannot be created and/or
+  deleted during iterations.<br/>
+  `EnTT` partially solves the problem with a few limitations:
 
 
-Benchmarks are compiled only in release mode currently.
+  * Creating entities and components is allowed during iterations.
+  * Deleting an entity or removing its components is allowed during
+    iterations if it's the one currently returned by a view. For all the
+    other entities, destroying them or removing their components isn't
+    allowed and it can result in undefined behavior.
+
+  Iterators are invalidated and the behaviour is undefined if an entity is
+  modified or destroyed and it's not the one currently returned by the
+  view.<br/>
+  To work around it, possible approaches are:
+
+    * Store aside the entities and the components to be removed and perform the
+      operations at the end of the iteration.
+    * Mark entities and components with a proper tag component that indicates
+      they must be purged, then perform a second iteration to clean them up one
+      by one.
+
+* Views and thus their iterators aren't thread safe. Do no try to iterate a set
+  of components and modify the same set concurrently.<br/>
+  That being said, as long as a thread iterates the entities that have the
+  component `X` or assign and removes that component from a set of entities,
+  another thread can safely do the same with components `Y` and `Z` and
+  everything will work like a charm.<br/>
+  As an example, users can freely execute the rendering system and iterate the
+  renderable entities while updating a physic component concurrently on a
+  separate thread if needed.
+
+## What else?
+
+The `EnTT` framework is moving its first steps. More and more will come in the
+future and hopefully I'm going to work on it for a long time.<br/>
+Here is a brief list of what it offers today:
+
+* Statically generated integer identifiers for types.
+* An entity-component system based on sparse sets.
+* Signal handlers and event emitters of any type.
+* ...
+* Any other business.
+
+Consider it a work in progress. For more details and an updated list, please
+refer to the [online documentation](https://skypjack.github.io/entt/).
 
 
 # Contributors
 # Contributors
 
 
-If you want to contribute, please send patches as pull requests against the branch master.<br/>
-Check the [contributors list](https://github.com/skypjack/entt/blob/master/AUTHORS) to see who has partecipated so far.
+If you want to contribute, please send patches as pull requests against the
+branch `master`.<br/>
+Check the
+[contributors list](https://github.com/skypjack/entt/blob/master/AUTHORS) to see
+who has partecipated so far.
 
 
 # License
 # License
 
 
 Code and documentation Copyright (c) 2017 Michele Caini.<br/>
 Code and documentation Copyright (c) 2017 Michele Caini.<br/>
-Code released under [the MIT license](https://github.com/skypjack/entt/blob/master/LICENSE).
+Code released under
+[the MIT license](https://github.com/skypjack/entt/blob/master/LICENSE).
+Docs released under
+[Creative Commons](https://github.com/skypjack/entt/blob/master/docs/LICENSE).
 
 
 # Donation
 # Donation
 
 
-Developing and maintaining `EnTT` takes some time and lots of coffee. If you want to support this project, you can offer me an espresso. I'm from Italy, we're used to turning the best coffee ever in code.<br/>
-Take a look at the donation button at the top of the page for more details or just click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted).
+Developing and maintaining `EnTT` takes some time and lots of coffee. I'd like
+to add more and more functionalities in future and turn it in a full-featured
+framework.<br/>
+If you want to support this project, you can offer me an espresso. I'm from
+Italy, we're used to turning the best coffee ever in code. If you find that
+it's not enough, feel free to support me the way you prefer.<br/>
+Take a look at the donation button at the top of the page for more details or
+just click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted).

+ 27 - 0
docs/CMakeLists.txt

@@ -0,0 +1,27 @@
+#
+# Doxygen configuration (documentation)
+#
+
+set(TARGET_DOCS docs)
+
+set(DOXY_IN_FILE doxy.in)
+
+set(DOXY_SOURCE_DIRECTORY ${PROJECT_SRC_DIR})
+set(DOXY_DOCS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+set(DOXY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+set(DOXY_CFG_FILE doxy.cfg)
+
+configure_file(${DOXY_IN_FILE} ${DOXY_CFG_FILE} @ONLY)
+
+add_custom_target(
+    ${TARGET_DOCS}
+    COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/${DOXY_CFG_FILE}
+    WORKING_DIRECTORY ${entt_SOURCE_DIR}
+    VERBATIM
+    SOURCES ${DOXY_IN_FILE}
+)
+
+install(
+    DIRECTORY ${DOXY_OUTPUT_DIRECTORY}/html
+    DESTINATION share/${PROJECT_NAME}-${PROJECT_VERSION}/
+)

+ 395 - 0
docs/LICENSE

@@ -0,0 +1,395 @@
+Attribution 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+     Considerations for licensors: Our public licenses are
+     intended for use by those authorized to give the public
+     permission to use material in ways otherwise restricted by
+     copyright and certain other rights. Our licenses are
+     irrevocable. Licensors should read and understand the terms
+     and conditions of the license they choose before applying it.
+     Licensors should also secure all rights necessary before
+     applying our licenses so that the public can reuse the
+     material as expected. Licensors should clearly mark any
+     material not subject to the license. This includes other CC-
+     licensed material, or material used under an exception or
+     limitation to copyright. More considerations for licensors:
+	wiki.creativecommons.org/Considerations_for_licensors
+
+     Considerations for the public: By using one of our public
+     licenses, a licensor grants the public permission to use the
+     licensed material under specified terms and conditions. If
+     the licensor's permission is not necessary for any reason--for
+     example, because of any applicable exception or limitation to
+     copyright--then that use is not regulated by the license. Our
+     licenses grant only permissions under copyright and certain
+     other rights that a licensor has authority to grant. Use of
+     the licensed material may still be restricted for other
+     reasons, including because others have copyright or other
+     rights in the material. A licensor may make special requests,
+     such as asking that all changes be marked or described.
+     Although not required by our licenses, you are encouraged to
+     respect those requests where reasonable. More_considerations
+     for the public: 
+	wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution 4.0 International Public License ("Public License"). To the
+extent this Public License may be interpreted as a contract, You are
+granted the Licensed Rights in consideration of Your acceptance of
+these terms and conditions, and the Licensor grants You such rights in
+consideration of benefits the Licensor receives from making the
+Licensed Material available under these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+  a. Adapted Material means material subject to Copyright and Similar
+     Rights that is derived from or based upon the Licensed Material
+     and in which the Licensed Material is translated, altered,
+     arranged, transformed, or otherwise modified in a manner requiring
+     permission under the Copyright and Similar Rights held by the
+     Licensor. For purposes of this Public License, where the Licensed
+     Material is a musical work, performance, or sound recording,
+     Adapted Material is always produced where the Licensed Material is
+     synched in timed relation with a moving image.
+
+  b. Adapter's License means the license You apply to Your Copyright
+     and Similar Rights in Your contributions to Adapted Material in
+     accordance with the terms and conditions of this Public License.
+
+  c. Copyright and Similar Rights means copyright and/or similar rights
+     closely related to copyright including, without limitation,
+     performance, broadcast, sound recording, and Sui Generis Database
+     Rights, without regard to how the rights are labeled or
+     categorized. For purposes of this Public License, the rights
+     specified in Section 2(b)(1)-(2) are not Copyright and Similar
+     Rights.
+
+  d. Effective Technological Measures means those measures that, in the
+     absence of proper authority, may not be circumvented under laws
+     fulfilling obligations under Article 11 of the WIPO Copyright
+     Treaty adopted on December 20, 1996, and/or similar international
+     agreements.
+
+  e. Exceptions and Limitations means fair use, fair dealing, and/or
+     any other exception or limitation to Copyright and Similar Rights
+     that applies to Your use of the Licensed Material.
+
+  f. Licensed Material means the artistic or literary work, database,
+     or other material to which the Licensor applied this Public
+     License.
+
+  g. Licensed Rights means the rights granted to You subject to the
+     terms and conditions of this Public License, which are limited to
+     all Copyright and Similar Rights that apply to Your use of the
+     Licensed Material and that the Licensor has authority to license.
+
+  h. Licensor means the individual(s) or entity(ies) granting rights
+     under this Public License.
+
+  i. Share means to provide material to the public by any means or
+     process that requires permission under the Licensed Rights, such
+     as reproduction, public display, public performance, distribution,
+     dissemination, communication, or importation, and to make material
+     available to the public including in ways that members of the
+     public may access the material from a place and at a time
+     individually chosen by them.
+
+  j. Sui Generis Database Rights means rights other than copyright
+     resulting from Directive 96/9/EC of the European Parliament and of
+     the Council of 11 March 1996 on the legal protection of databases,
+     as amended and/or succeeded, as well as other essentially
+     equivalent rights anywhere in the world.
+
+  k. You means the individual or entity exercising the Licensed Rights
+     under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+  a. License grant.
+
+       1. Subject to the terms and conditions of this Public License,
+          the Licensor hereby grants You a worldwide, royalty-free,
+          non-sublicensable, non-exclusive, irrevocable license to
+          exercise the Licensed Rights in the Licensed Material to:
+
+            a. reproduce and Share the Licensed Material, in whole or
+               in part; and
+
+            b. produce, reproduce, and Share Adapted Material.
+
+       2. Exceptions and Limitations. For the avoidance of doubt, where
+          Exceptions and Limitations apply to Your use, this Public
+          License does not apply, and You do not need to comply with
+          its terms and conditions.
+
+       3. Term. The term of this Public License is specified in Section
+          6(a).
+
+       4. Media and formats; technical modifications allowed. The
+          Licensor authorizes You to exercise the Licensed Rights in
+          all media and formats whether now known or hereafter created,
+          and to make technical modifications necessary to do so. The
+          Licensor waives and/or agrees not to assert any right or
+          authority to forbid You from making technical modifications
+          necessary to exercise the Licensed Rights, including
+          technical modifications necessary to circumvent Effective
+          Technological Measures. For purposes of this Public License,
+          simply making modifications authorized by this Section 2(a)
+          (4) never produces Adapted Material.
+
+       5. Downstream recipients.
+
+            a. Offer from the Licensor -- Licensed Material. Every
+               recipient of the Licensed Material automatically
+               receives an offer from the Licensor to exercise the
+               Licensed Rights under the terms and conditions of this
+               Public License.
+
+            b. No downstream restrictions. You may not offer or impose
+               any additional or different terms or conditions on, or
+               apply any Effective Technological Measures to, the
+               Licensed Material if doing so restricts exercise of the
+               Licensed Rights by any recipient of the Licensed
+               Material.
+
+       6. No endorsement. Nothing in this Public License constitutes or
+          may be construed as permission to assert or imply that You
+          are, or that Your use of the Licensed Material is, connected
+          with, or sponsored, endorsed, or granted official status by,
+          the Licensor or others designated to receive attribution as
+          provided in Section 3(a)(1)(A)(i).
+
+  b. Other rights.
+
+       1. Moral rights, such as the right of integrity, are not
+          licensed under this Public License, nor are publicity,
+          privacy, and/or other similar personality rights; however, to
+          the extent possible, the Licensor waives and/or agrees not to
+          assert any such rights held by the Licensor to the limited
+          extent necessary to allow You to exercise the Licensed
+          Rights, but not otherwise.
+
+       2. Patent and trademark rights are not licensed under this
+          Public License.
+
+       3. To the extent possible, the Licensor waives any right to
+          collect royalties from You for the exercise of the Licensed
+          Rights, whether directly or through a collecting society
+          under any voluntary or waivable statutory or compulsory
+          licensing scheme. In all other cases the Licensor expressly
+          reserves any right to collect such royalties.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+  a. Attribution.
+
+       1. If You Share the Licensed Material (including in modified
+          form), You must:
+
+            a. retain the following if it is supplied by the Licensor
+               with the Licensed Material:
+
+                 i. identification of the creator(s) of the Licensed
+                    Material and any others designated to receive
+                    attribution, in any reasonable manner requested by
+                    the Licensor (including by pseudonym if
+                    designated);
+
+                ii. a copyright notice;
+
+               iii. a notice that refers to this Public License;
+
+                iv. a notice that refers to the disclaimer of
+                    warranties;
+
+                 v. a URI or hyperlink to the Licensed Material to the
+                    extent reasonably practicable;
+
+            b. indicate if You modified the Licensed Material and
+               retain an indication of any previous modifications; and
+
+            c. indicate the Licensed Material is licensed under this
+               Public License, and include the text of, or the URI or
+               hyperlink to, this Public License.
+
+       2. You may satisfy the conditions in Section 3(a)(1) in any
+          reasonable manner based on the medium, means, and context in
+          which You Share the Licensed Material. For example, it may be
+          reasonable to satisfy the conditions by providing a URI or
+          hyperlink to a resource that includes the required
+          information.
+
+       3. If requested by the Licensor, You must remove any of the
+          information required by Section 3(a)(1)(A) to the extent
+          reasonably practicable.
+
+       4. If You Share Adapted Material You produce, the Adapter's
+          License You apply must not prevent recipients of the Adapted
+          Material from complying with this Public License.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+  a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+     to extract, reuse, reproduce, and Share all or a substantial
+     portion of the contents of the database;
+
+  b. if You include all or a substantial portion of the database
+     contents in a database in which You have Sui Generis Database
+     Rights, then the database in which You have Sui Generis Database
+     Rights (but not its individual contents) is Adapted Material; and
+
+  c. You must comply with the conditions in Section 3(a) if You Share
+     all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+  a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+     EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+     AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+     ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+     IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+     WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+     PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+     ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+     KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+     ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+  b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+     TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+     NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+     INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+     COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+     USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+     ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+     DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+     IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+  c. The disclaimer of warranties and limitation of liability provided
+     above shall be interpreted in a manner that, to the extent
+     possible, most closely approximates an absolute disclaimer and
+     waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+  a. This Public License applies for the term of the Copyright and
+     Similar Rights licensed here. However, if You fail to comply with
+     this Public License, then Your rights under this Public License
+     terminate automatically.
+
+  b. Where Your right to use the Licensed Material has terminated under
+     Section 6(a), it reinstates:
+
+       1. automatically as of the date the violation is cured, provided
+          it is cured within 30 days of Your discovery of the
+          violation; or
+
+       2. upon express reinstatement by the Licensor.
+
+     For the avoidance of doubt, this Section 6(b) does not affect any
+     right the Licensor may have to seek remedies for Your violations
+     of this Public License.
+
+  c. For the avoidance of doubt, the Licensor may also offer the
+     Licensed Material under separate terms or conditions or stop
+     distributing the Licensed Material at any time; however, doing so
+     will not terminate this Public License.
+
+  d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+     License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+  a. The Licensor shall not be bound by any additional or different
+     terms or conditions communicated by You unless expressly agreed.
+
+  b. Any arrangements, understandings, or agreements regarding the
+     Licensed Material not stated herein are separate from and
+     independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+  a. For the avoidance of doubt, this Public License does not, and
+     shall not be interpreted to, reduce, limit, restrict, or impose
+     conditions on any use of the Licensed Material that could lawfully
+     be made without permission under this Public License.
+
+  b. To the extent possible, if any provision of this Public License is
+     deemed unenforceable, it shall be automatically reformed to the
+     minimum extent necessary to make it enforceable. If the provision
+     cannot be reformed, it shall be severed from this Public License
+     without affecting the enforceability of the remaining terms and
+     conditions.
+
+  c. No term or condition of this Public License will be waived and no
+     failure to comply consented to unless expressly agreed to by the
+     Licensor.
+
+  d. Nothing in this Public License constitutes or may be interpreted
+     as a limitation upon, or waiver of, any privileges and immunities
+     that apply to the Licensor or You, including from the legal
+     processes of any jurisdiction or authority.
+
+
+=======================================================================
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the “Licensor.” The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.

+ 2446 - 0
docs/doxy.in

@@ -0,0 +1,2446 @@
+# Doxyfile 1.8.13
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = @PROJECT_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         = @PROJECT_VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = @DOXY_OUTPUT_DIRECTORY@
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 0.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS   = 4
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = YES
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered.
+# The default value is: NO.
+
+WARN_AS_ERROR          = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = @DOXY_SOURCE_DIRECTORY@ @DOXY_DOCS_DIRECTORY@ @PROJECT_SOURCE_DIR@/README.md
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
+# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
+# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
+
+FILE_PATTERNS          = *.cpp \
+                         *.c++ \
+                         *.h \
+                         *.hpp \
+                         *.md \
+                         *.dox
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = @PROJECT_SOURCE_DIR@/README.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse-libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = NO
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sf.net) file that captures the
+# structure of the code including all documentation. Note that this feature is
+# still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: YES.
+
+HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
+# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
+# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
+# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      =
+
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE      =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES

+ 5 - 0
docs/extra.dox

@@ -0,0 +1,5 @@
+/**
+ * @namespace entt
+ *
+ * @brief `EnTT` default namespace.
+ */

+ 43 - 0
src/entt/core/family.hpp

@@ -0,0 +1,43 @@
+#ifndef ENTT_CORE_FAMILY_HPP
+#define ENTT_CORE_FAMILY_HPP
+
+
+#include<type_traits>
+#include<cstddef>
+#include<utility>
+
+
+namespace entt {
+
+
+/**
+ * @brief Dynamic identifier generator.
+ *
+ * Utility class template that can be used to assign unique identifiers to types
+ * at runtime. Use different specializations to create separate sets of
+ * identifiers.
+ */
+template<typename...>
+class Family {
+    static std::size_t identifier() noexcept {
+        static std::size_t value = 0;
+        return value++;
+    }
+
+public:
+    /**
+     * @brief Returns an unique identifier for the given type.
+     * @return Statically generated unique identifier for the given type.
+     */
+    template<typename...>
+    static std::size_t type() noexcept {
+        static const std::size_t value = identifier();
+        return value;
+    }
+};
+
+
+}
+
+
+#endif // ENTT_CORE_FAMILY_HPP

+ 71 - 0
src/entt/core/ident.hpp

@@ -0,0 +1,71 @@
+#ifndef ENTT_CORE_IDENT_HPP
+#define ENTT_CORE_IDENT_HPP
+
+
+#include<type_traits>
+#include<cstddef>
+#include<utility>
+
+
+namespace entt {
+
+
+namespace {
+
+
+template<typename Type>
+struct Wrapper {
+    using type = Type;
+    constexpr Wrapper(std::size_t index): index{index} {}
+    const std::size_t index;
+};
+
+
+template<typename... Types>
+struct Identifier final: Wrapper<Types>... {
+    template<std::size_t... Indexes>
+    constexpr Identifier(std::index_sequence<Indexes...>): Wrapper<Types>{Indexes}... {}
+
+    template<typename Type>
+    constexpr std::size_t get() const { return Wrapper<std::decay_t<Type>>::index; }
+};
+
+
+}
+
+
+/**
+ * @brief Types identifers.
+ *
+ * Variable template used to generate identifiers at compile-time for the given
+ * types. Use the `constexpr` `get` member function to know what's the
+ * identifier associated to the specific type.
+ *
+ * @note
+ * Identifiers are constant expression and can be used in any context where such
+ * an expression is required. As an example:
+ * @code{.cpp}
+ * constexpr auto identifiers = entt::ident<AType, AnotherType>;
+ *
+ * switch(aTypeIdentifier) {
+ * case identifers.get<AType>():
+ *     // ...
+ *     break;
+ * case identifers.get<AnotherType>():
+ *     // ...
+ *     break;
+ * default:
+ *     // ...
+ * }
+ * @endcode
+ *
+ * @tparam Types The list of types for which to generate identifiers.
+ */
+template<typename... Types>
+constexpr auto ident = Identifier<std::decay_t<Types>...>{std::make_index_sequence<sizeof...(Types)>{}};
+
+
+}
+
+
+#endif // ENTT_CORE_IDENT_HPP

+ 746 - 0
src/entt/entity/registry.hpp

@@ -0,0 +1,746 @@
+#ifndef ENTT_ENTITY_REGISTRY_HPP
+#define ENTT_ENTITY_REGISTRY_HPP
+
+
+#include <vector>
+#include <memory>
+#include <utility>
+#include <cstddef>
+#include <cassert>
+#include "../core/family.hpp"
+#include "sparse_set.hpp"
+#include "traits.hpp"
+#include "view.hpp"
+
+
+namespace entt {
+
+
+/**
+ * @brief A repository class for entities and components.
+ *
+ * The registry is the core class of the entity-component framework.<br/>
+ * It stores entities and arranges pools of components on a per request basis.
+ * By means of a registry, users can manage entities and components and thus
+ * create views to iterate them.
+ *
+ * @tparam Entity A valid entity type (see entt_traits for more details).
+ */
+template<typename Entity>
+class Registry {
+    using component_family = Family<struct InternalRegistryComponentFamily>;
+    using view_family = Family<struct InternalRegistryViewFamily>;
+    using traits_type = entt_traits<Entity>;
+
+    template<typename Component>
+    struct Pool: SparseSet<Entity, Component> {
+        using test_fn_type = bool(Registry::*)(Entity) const;
+
+        template<typename... Args>
+        Component & construct(Registry &registry, Entity entity, Args&&... args) {
+            auto &component = SparseSet<Entity, Component>::construct(entity, std::forward<Args>(args)...);
+
+            for(auto &&listener: listeners) {
+                if((registry.*listener.second)(entity)) {
+                    listener.first.construct(entity);
+                }
+            }
+
+            return component;
+        }
+
+        void destroy(Entity entity) override {
+            SparseSet<Entity, Component>::destroy(entity);
+
+            for(auto &&listener: listeners) {
+                auto &handler = listener.first;
+
+                if(handler.has(entity)) {
+                    handler.destroy(entity);
+                }
+            }
+        }
+
+        void append(SparseSet<Entity> &handler, test_fn_type fn) {
+            listeners.emplace_back(handler, fn);
+        }
+
+    private:
+        std::vector<std::pair<SparseSet<Entity> &, test_fn_type>> listeners;
+    };
+
+    template<typename Component>
+    bool managed() const noexcept {
+        const auto ctype = component_family::type<Component>();
+        return ctype < pools.size() && pools[ctype];
+    }
+
+    template<typename Component>
+    const Pool<Component> & pool() const noexcept {
+        assert(managed<Component>());
+        return static_cast<Pool<Component> &>(*pools[component_family::type<Component>()]);
+    }
+
+    template<typename Component>
+    Pool<Component> & pool() noexcept {
+        assert(managed<Component>());
+        return const_cast<Pool<Component> &>(const_cast<const Registry *>(this)->pool<Component>());
+    }
+
+    template<typename Component>
+    Pool<Component> & ensure() {
+        const auto ctype = component_family::type<Component>();
+
+        if(!(ctype < pools.size())) {
+            pools.resize(ctype + 1);
+        }
+
+        if(!pools[ctype]) {
+            pools[ctype] = std::make_unique<Pool<Component>>();
+        }
+
+        return pool<Component>();
+    }
+
+public:
+    /*! @brief Underlying entity identifier. */
+    using entity_type = typename traits_type::entity_type;
+    /*! @brief Underlying version type. */
+    using version_type = typename traits_type::version_type;
+    /*! @brief Unsigned integer type. */
+    using size_type = std::size_t;
+
+    /*! @brief Default constructor, explicit on purpose. */
+    explicit Registry() = default;
+    /*! @brief Default destructor. */
+    ~Registry() = default;
+
+    /*! @brief Copying a sparse set isn't allowed. */
+    Registry(const Registry &) = delete;
+    /*! @brief Moving a sparse set isn't allowed. */
+    Registry(Registry &&) = delete;
+
+    /*! @brief Copying a sparse set isn't allowed. @return This sparse set. */
+    Registry & operator=(const Registry &) = delete;
+    /*! @brief Moving a sparse set isn't allowed. @return This sparse set. */
+    Registry & operator=(Registry &&) = delete;
+
+    /**
+     * @brief Returns the number of existing components of the given type.
+     * @tparam Component The type of the component to which to return the size.
+     * @return The number of existing components of the given type.
+     */
+    template<typename Component>
+    size_type size() const noexcept {
+        return managed<Component>() ? pool<Component>().size() : size_type{};
+    }
+
+    /**
+     * @brief Returns the number of entities still in use.
+     * @return The number of entities still in use.
+     */
+    size_type size() const noexcept {
+        return entities.size() - available.size();
+    }
+
+    /**
+     * @brief Returns the number of entities ever created.
+     * @return The number of entities ever created.
+     */
+    size_type capacity() const noexcept {
+        return entities.size();
+    }
+
+    /**
+     * @brief Checks whether the pool for the given component is empty.
+     * @tparam Component The type of the component in which one is interested.
+     * @return True if the pool for the given component is empty, false
+     * otherwise.
+     */
+    template<typename Component>
+    bool empty() const noexcept {
+        return managed<Component>() ? pool<Component>().empty() : true;
+    }
+
+    /**
+     * @brief Checks if there exists at least an entity still in use.
+     * @return True if at least an entity is still in use, false otherwise.
+     */
+    bool empty() const noexcept {
+        return entities.size() == available.size();
+    }
+
+    /**
+     * @brief Verifies if the entity identifier still refers to a valid entity.
+     * @param entity An entity identifier, either valid or not.
+     * @return True if the identifier is still valid, false otherwise.
+     */
+    bool valid(entity_type entity) const noexcept {
+        const auto entt = entity & traits_type::entity_mask;
+        return (entt < entities.size() && entities[entt] == entity);
+    }
+
+    /**
+     * @brief Returns the version stored along with the given entity identifier.
+     * @param entity An entity identifier, either valid or not.
+     * @return The version stored along with the given entity identifier.
+     */
+    version_type version(entity_type entity) const noexcept {
+        return version_type((entity >> traits_type::version_shift) & traits_type::version_mask);
+    }
+
+    /**
+     * @brief Returns the actual version for the given entity identifier.
+     *
+     * In case entity identifers are stored around, this function can be used to
+     * know if they are still valid or the entity has been destroyed and
+     * potentially recycled.
+     *
+     * @warning
+     * Attempting to use an entity that doesn't belong to the registry results
+     * in undefined behavior. An entity belongs to the registry even if it has
+     * been previously destroyed and/or recycled.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * registry doesn't own the given entity.
+     *
+     * @param entity A valid entity identifier.
+     * @return The actual version for the given entity identifier.
+     */
+    version_type current(entity_type entity) const noexcept {
+        const auto entt = entity & traits_type::entity_mask;
+        assert(entt < entities.size());
+        return version_type((entities[entt] >> traits_type::version_shift) & traits_type::version_mask);
+    }
+
+    /**
+     * @brief Returns a new entity to which the given components are assigned.
+     *
+     * There are two kinds of entity identifiers:
+     * * Newly created ones in case no entities have been previously destroyed.
+     * * Recycled one with updated versions.
+     *
+     * Users should not care about the type of the returned entity identifier.
+     * In case entity identifers are stored around, the `current` member
+     * function can be used to know if they are still valid or the entity has
+     * been destroyed and potentially recycled.
+     *
+     * @tparam Component A list of components to assign to the entity.
+     * @return A valid entity identifier.
+     */
+    template<typename... Component>
+    entity_type create() noexcept {
+        using accumulator_type = int[];
+        const auto entity = create();
+        accumulator_type accumulator = { 0, (ensure<Component>().construct(*this, entity), 0)... };
+        (void)accumulator;
+        return entity;
+    }
+
+    /**
+     * @brief Creates a new entity and returns it.
+     *
+     * There are two kinds of entity identifiers:
+     * * Newly created ones in case no entities have been previously destroyed.
+     * * Recycled one with updated versions.
+     *
+     * Users should not care about the type of the returned entity identifier.
+     * In case entity identifers are stored around, the `current` member
+     * function can be used to know if they are still valid or the entity has
+     * been destroyed and potentially recycled.
+     *
+     * @return A valid entity identifier.
+     */
+    entity_type create() noexcept {
+        entity_type entity;
+
+        if(available.empty()) {
+            entity = entity_type(entities.size());
+            assert((entity >> traits_type::version_shift) == entity_type{});
+            entities.push_back(entity);
+        } else {
+            entity = available.back();
+            available.pop_back();
+        }
+
+        return entity;
+    }
+
+    /**
+     * @brief Destroys an entity and lets the registry recycle the identifier.
+     *
+     * When an entity is destroyed, its version is updated and the identifier
+     * can be recycled at any time. In case entity identifers are stored around,
+     * the `current` member function can be used to know if they are still valid
+     * or the entity has been destroyed and potentially recycled.
+     *
+     * @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 entity A valid entity identifier
+     */
+    void destroy(entity_type entity) {
+        assert(valid(entity));
+
+        const auto entt = entity & traits_type::entity_mask;
+        const auto version = 1 + ((entity >> traits_type::version_shift) & traits_type::version_mask);
+        entities[entt] = entt | (version << traits_type::version_shift);
+        available.push_back(entity);
+
+        for(auto &&cpool: pools) {
+            if(cpool && cpool->has(entity)) {
+                cpool->destroy(entity);
+            }
+        }
+    }
+
+    /**
+     * @brief Assigns the given component to the given entity.
+     *
+     * A new instance of the given component is created and initialized with the
+     * arguments provided (the component must have a proper constructor or be of
+     * aggregate type). Then the component is assigned to the given entity.
+     *
+     * @warning
+     * Attempting to use an invalid entity or to assign a component to an entity
+     * that already owns it results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode in case of
+     * invalid entity or if the entity already owns an instance of the given
+     * component.
+     *
+     * @tparam Component The type of the component to create.
+     * @tparam Args The types of the arguments used to construct the component.
+     * @param entity A valid entity identifier.
+     * @param args The parameters to use to initialize the component.
+     * @return A reference to the newly created component.
+     */
+    template<typename Component, typename... Args>
+    Component & assign(entity_type entity, Args&&... args) {
+        assert(valid(entity));
+        return ensure<Component>().construct(*this, entity, std::forward<Args>(args)...);
+    }
+
+    /**
+     * @brief Removes the given component from the given entity.
+     *
+     * @warning
+     * Attempting to use an invalid entity or to remove a component from an
+     * entity that doesn't own it results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode in case of
+     * invalid entity or if the entity doesn't own an instance of the given
+     * component.
+     *
+     * @tparam Component The type of the component to remove.
+     * @param entity A valid entity identifier.
+     */
+    template<typename Component>
+    void remove(entity_type entity) {
+        assert(valid(entity));
+        return pool<Component>().destroy(entity);
+    }
+
+    /**
+     * @brief Checks if the given entity has all the given components.
+     *
+     * @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.
+     *
+     * @tparam Component The components for which to perform the check.
+     * @param entity A valid entity identifier.
+     * @return True if the entity has all the components, false otherwise.
+     */
+    template<typename... Component>
+    bool has(entity_type entity) const noexcept {
+        static_assert(sizeof...(Component) > 0, "!");
+        assert(valid(entity));
+        using accumulator_type = bool[];
+        bool all = true;
+        accumulator_type accumulator = { (all = all && managed<Component>() && pool<Component>().has(entity))... };
+        (void)accumulator;
+        return all;
+    }
+
+    /**
+     * @brief Gets a reference to the given component owned by the given entity.
+     *
+     * @warning
+     * Attempting to use an invalid entity or to get a component from an entity
+     * that doesn't own it results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode in case of
+     * invalid entity or if the entity doesn't own an instance of the given
+     * component.
+     *
+     * @tparam Component The type of the component to get.
+     * @param entity A valid entity identifier.
+     * @return A reference to the instance of the component owned by the entity.
+     */
+    template<typename Component>
+    const Component & get(entity_type entity) const noexcept {
+        assert(valid(entity));
+        return pool<Component>().get(entity);
+    }
+
+    /**
+     * @brief Gets a reference to the given component owned by the given entity.
+     *
+     * @warning
+     * Attempting to use an invalid entity or to get a component from an entity
+     * that doesn't own it results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode in case of
+     * invalid entity or if the entity doesn't own an instance of the given
+     * component.
+     *
+     * @tparam Component The type of the component to get.
+     * @param entity A valid entity identifier.
+     * @return A reference to the instance of the component owned by the entity.
+     */
+    template<typename Component>
+    Component & get(entity_type entity) noexcept {
+        return const_cast<Component &>(const_cast<const Registry *>(this)->get<Component>(entity));
+    }
+
+    /**
+     * @brief Replaces the given component for the given entity.
+     *
+     * A new instance of the given component is created and initialized with the
+     * arguments provided (the component must have a proper constructor or be of
+     * aggregate type). Then the component is assigned to the given entity.
+     *
+     * @warning
+     * Attempting to use an invalid entity or to replace a component of an
+     * entity that doesn't own it results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode in case of
+     * invalid entity or if the entity doesn't own an instance of the given
+     * component.
+     *
+     * @tparam Component The type of the component to replace.
+     * @tparam Args The types of the arguments used to construct the component.
+     * @param entity A valid entity identifier.
+     * @param args The parameters to use to initialize the component.
+     * @return A reference to the newly created component.
+     */
+    template<typename Component, typename... Args>
+    Component & replace(entity_type entity, Args&&... args) {
+        assert(valid(entity));
+        return (pool<Component>().get(entity) = Component{std::forward<Args>(args)...});
+    }
+
+    /**
+     * @brief Assigns or replaces the given component to the given entity.
+     *
+     * Equivalent to the following snippet (pseudocode):
+     *
+     * @code{.cpp}
+     * if(registry.has<Component>(entity)) {
+     *     registry.replace<Component>(entity, args...);
+     * } else {
+     *     registry.assign<Component>(entity, args...);
+     * }
+     * @endcode
+     *
+     * Prefer this function anyway because it has slighlty better
+     * performance.
+     *
+     * @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.
+     *
+     * @tparam Component The type of the component to assign or replace.
+     * @tparam Args The types of the arguments used to construct the component.
+     * @param entity A valid entity identifier.
+     * @param args The parameters to use to initialize the component.
+     * @return A reference to the newly created component.
+     */
+    template<typename Component, typename... Args>
+    Component & accomodate(entity_type entity, Args&&... args) {
+        assert(valid(entity));
+        auto &cpool = ensure<Component>();
+
+        return (cpool.has(entity)
+                ? (cpool.get(entity) = Component{std::forward<Args>(args)...})
+                : cpool.construct(*this, entity, std::forward<Args>(args)...));
+    }
+
+    /**
+     * @brief Sorts the pool of the given component.
+     *
+     * The order of the elements in a pool is highly affected by assignements
+     * of components to entities and deletions. Components are arranged to
+     * maximize the performance during iterations and users should not make any
+     * assumption on the order.<br/>
+     * This function can be used to impose an order to the elements in the pool
+     * for the given component. The order is kept valid until a component of the
+     * given type is assigned or removed from an entity.
+     *
+     * The comparison function object must return `true` if the first element
+     * is _less_ than the second one, `false` otherwise. The signature of the
+     * comparison function should be equivalent to the following:
+     *
+     * @code{.cpp}
+     * bool(auto e1, auto e2)
+     * @endcode
+     *
+     * Where `e1` and `e2` are valid entity identifiers.
+     *
+     * @tparam Component The type of the components to sort.
+     * @tparam Compare The type of the comparison function object.
+     * @param compare A valid comparison function object.
+     */
+    template<typename Component, typename Compare>
+    void sort(Compare compare) {
+        auto &cpool = ensure<Component>();
+
+        cpool.sort([&cpool, compare = std::move(compare)](auto lhs, auto rhs) {
+            return compare(static_cast<const Component &>(cpool.get(lhs)), static_cast<const Component &>(cpool.get(rhs)));
+        });
+    }
+
+    /**
+     * @brief Sorts two pools of components in the same way.
+     *
+     * The order of the elements in a pool is highly affected by assignements
+     * of components to entities and deletions. Components are arranged to
+     * maximize the performance during iterations and users should not make any
+     * assumption on the order.
+     *
+     * It happens that different pools of components must be sorted the same way
+     * because of runtime and/or performance constraints. This function can be
+     * used to order a pool of components according to the order between the
+     * entities in another pool of components.
+     *
+     * @b How @b it @b works
+     *
+     * Being `A` and `B` the two sets where `B` is the master (the one the order
+     * of which rules) and `A` is the slave (the one to sort), after a call to
+     * this function an iterator for `A` will return the entities according to
+     * the following rules:
+     *
+     * * All the entities in `A` that are also in `B` are returned first
+     * according to the order they have in `B`.
+     * * All the entities in `A` that are not in `B` are returned in no
+     * particular order after all the other entities.
+     *
+     * Any subsequent change to `B` won't affect the order in `A`.
+     *
+     * @tparam To The type of the components to sort.
+     * @tparam From The type of the components to use to sort.
+     */
+    template<typename To, typename From>
+    void sort() {
+        ensure<To>().respect(ensure<From>());
+    }
+
+    /**
+     * @brief Resets the given component for the given entity.
+     *
+     * If the entity has an instance of the component, this function removes the
+     * component from the entity. Otherwise it does nothing.
+     *
+     * @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.
+     *
+     * @tparam Component The component to reset.
+     * @param entity A valid entity identifier.
+     */
+    template<typename Component>
+    void reset(entity_type entity) {
+        assert(valid(entity));
+
+        if(managed<Component>()) {
+            auto &cpool = pool<Component>();
+
+            if(cpool.has(entity)) {
+                cpool.destroy(entity);
+            }
+        }
+    }
+
+    /**
+     * @brief Resets the pool of the given component.
+     *
+     * For each entity that has an instance of the given component, the
+     * component itself is removed and thus destroyed.
+     *
+     * @tparam Component The component whose pool must be reset.
+     */
+    template<typename Component>
+    void reset() {
+        if(managed<Component>()) {
+            auto &cpool = pool<Component>();
+
+            for(auto entity: entities) {
+                if(cpool.has(entity)) {
+                    cpool.destroy(entity);
+                }
+            }
+        }
+    }
+
+    /**
+     * @brief Resets the whole registry.
+     *
+     * Destroys all the entities. After a call to `reset`, all the entities
+     * previously created are recycled with a new version number. In case entity
+     * identifers are stored around, the `current` member function can be used
+     * to know if they are still valid.
+     */
+    void reset() {
+        available.clear();
+        pools.clear();
+
+        for(auto &&entity: entities) {
+            const auto version = 1 + ((entity >> traits_type::version_shift) & traits_type::version_mask);
+            entity = (entity & traits_type::entity_mask) | (version << traits_type::version_shift);
+            available.push_back(entity);
+        }
+    }
+
+    /**
+     * @brief Returns a standard view for the given components.
+     *
+     * This kind of views are created on the fly and share with the registry its
+     * internal data structures.<br/>
+     * Feel free to discard a view after the use. Creating and destroying a view
+     * is an incredibly cheap operation because they do not require any type of
+     * initialization.<br/>
+     * As a rule of thumb, storing a view should never be an option.
+     *
+     * Standard views do their best to iterate the smallest set of candidate
+     * entites. In particular:
+     * * Single component views are incredibly fast and iterate a packed array
+     * of entities, all of which has the given component.
+     * * Multi component views look at the number of entities available for each
+     * component and pick up a reference to the smallest set of candidates to
+     * test for the given components.
+     *
+     * @note
+     * Multi component views are pretty fast. However their performance tend to
+     * degenerate when the number of components to iterate grows up and the most
+     * of the entities have all the given components.<br/>
+     * To get a performance boost, consider using a PersistentView instead.
+     *
+     * @see View
+     * @see View<Entity, Component>
+     * @see PersistentView
+     *
+     * @tparam Component The type of the components used to construct the view.
+     * @return A newly created standard view.
+     */
+    template<typename... Component>
+    View<Entity, Component...> view() {
+        return View<Entity, Component...>{ensure<Component>()...};
+    }
+
+    /**
+     * @brief Prepares the internal data structures used by persistent views.
+     *
+     * Persistent views are an incredibly fast tool used to iterate a packed
+     * array of entities all of which have specific components.<br/>
+     * The initialization of a persistent view is also a pretty cheap operation,
+     * but for the first time they are created. That's mainly because of the
+     * internal data structures of the registry that are dedicated to this kind
+     * of views and that don't exist yet the very first time they are
+     * requested.<br/>
+     * To avoid costly operations, internal data structures for persistent views
+     * can be prepared with this function. Just use the same set of components
+     * that would have been used otherwise to contruct the view.
+     *
+     * @tparam Component The types of the components used to prepare the view.
+     */
+    template<typename... Component>
+    void prepare() {
+        static_assert(sizeof...(Component) > 1, "!");
+        const auto vtype = view_family::type<Component...>();
+
+        if(!(vtype < handlers.size())) {
+            handlers.resize(vtype + 1);
+        }
+
+        if(!handlers[vtype]) {
+            using accumulator_type = int[];
+
+            auto handler = std::make_unique<SparseSet<Entity>>();
+
+            for(auto entity: view<Component...>()) {
+                handler->construct(entity);
+            }
+
+            accumulator_type accumulator = {
+                (ensure<Component>().append(*handler, &Registry::has<Component...>), 0)...
+            };
+
+            handlers[vtype] = std::move(handler);
+            (void)accumulator;
+        }
+    }
+
+    /**
+     * @brief Returns a persistent view for the given components.
+     *
+     * This kind of views are created on the fly and share with the registry its
+     * internal data structures.<br/>
+     * Feel free to discard a view after the use. Creating and destroying a view
+     * is an incredibly cheap operation because they do not require any type of
+     * initialization.<br/>
+     * As a rule of thumb, storing a view should never be an option.
+     *
+     * Persistent views are the right choice to iterate entites when the number
+     * of components grows up and the most of the entities have all the given
+     * components.<br/>
+     * However they have also drawbacks:
+     * * Each kind of persistent view requires a dedicated data structure that
+     * is allocated within the registry and it increases memory pressure.
+     * * Internal data structures used to construct persistent views must be
+     * kept updated and it affects slightly construction and destruction of
+     * entities and components.
+     *
+     * That being said, persistent views are an incredibly powerful tool if used
+     * with care and offer a boost of performance undoubtedly.
+     *
+     * @note
+     * Consider to use the `prepare` member function to initialize the internal
+     * data structures used by persistent views when the registry is still
+     * empty. Initialization could be a costly operation otherwise and it will
+     * be performed the very first time each view is created.
+     *
+     * @see View
+     * @see View<Entity, Component>
+     * @see PersistentView
+     *
+     * @tparam Component The types of the components used to construct the view.
+     * @return A newly created persistent view.
+     */
+    template<typename... Component>
+    PersistentView<Entity, Component...> persistent() {
+        static_assert(sizeof...(Component) > 1, "!");
+        prepare<Component...>();
+        return PersistentView<Entity, Component...>{*handlers[view_family::type<Component...>()], ensure<Component>()...};
+    }
+
+private:
+    std::vector<std::unique_ptr<SparseSet<Entity>>> handlers;
+    std::vector<std::unique_ptr<SparseSet<Entity>>> pools;
+    std::vector<entity_type> available;
+    std::vector<entity_type> entities;
+};
+
+
+/**
+ * @brief Default registry class.
+ *
+ * The default registry is the best choice for almost all the applications.<br/>
+ * Users should have a really good reason to choose something different.
+ */
+using DefaultRegistry = Registry<std::uint32_t>;
+
+
+}
+
+
+#endif // ENTT_ENTITY_REGISTRY_HPP

+ 575 - 0
src/entt/entity/sparse_set.hpp

@@ -0,0 +1,575 @@
+#ifndef ENTT_ENTITY_SPARSE_SET_HPP
+#define ENTT_ENTITY_SPARSE_SET_HPP
+
+
+#include <algorithm>
+#include <utility>
+#include <vector>
+#include <cstddef>
+#include <cassert>
+#include "traits.hpp"
+
+
+namespace entt {
+
+
+/**
+ * @brief Sparse set.
+ *
+ * Primary template isn't defined on purpose. All the specializations give a
+ * compile-time error, but for a few reasonable cases.
+ */
+template<typename...>
+class SparseSet;
+
+
+/**
+ * @brief Basic sparse set implementation.
+ *
+ * Sparse set or packed array or whatever is the name users give it.<br/>
+ * Two arrays: an _external_ one and an _internal_ one; a _sparse_ one and a
+ * _packed_ one; one used for direct access through contiguous memory, the other
+ * one used to get the data through an extra level of indirection.<br/>
+ * This is largely used by the Registry to offer users the fastest access ever
+ * to the components. View and PersistentView are entirely designed around
+ * sparse sets.
+ *
+ * This type of data structure is widely documented in the literature and on the
+ * web. This is nothing more than a customized implementation suitable for the
+ * purpose of the framework.
+ *
+ * @note
+ * There are no guarantees that entities are returned in the insertion order
+ * when iterate a sparse set. Do not make assumption on the order in any case.
+ *
+ * @note
+ * Internal data structures arrange elements to maximize performance. Because of
+ * that, there are no guarantees that elements have the expected order when
+ * iterate directly the internal packed array (see `data` and `size` member
+ * functions for that). Use `begin` and `end` instead.
+ *
+ * @tparam Entity A valid entity type (see entt_traits for more details).
+ */
+template<typename Entity>
+class SparseSet<Entity> {
+    using traits_type = entt_traits<Entity>;
+
+    struct Iterator {
+        using value_type = Entity;
+
+        Iterator(const std::vector<Entity> *direct, std::size_t pos)
+            : direct{direct}, pos{pos}
+        {}
+
+        Iterator & operator++() noexcept {
+            return --pos, *this;
+        }
+
+        Iterator operator++(int) noexcept {
+            Iterator orig = *this;
+            return ++(*this), orig;
+        }
+
+        bool operator==(const Iterator &other) const noexcept {
+            return other.pos == pos && other.direct == direct;
+        }
+
+        bool operator!=(const Iterator &other) const noexcept {
+            return !(*this == other);
+        }
+
+        value_type operator*() const noexcept {
+            return (*direct)[pos-1];
+        }
+
+    private:
+        const std::vector<Entity> *direct;
+        std::size_t pos;
+    };
+
+public:
+    /*! @brief Underlying entity identifier. */
+    using entity_type = Entity;
+    /*! @brief Entity dependent position type. */
+    using pos_type = entity_type;
+    /*! @brief Unsigned integer type. */
+    using size_type = std::size_t;
+    /*! @brief Input iterator type. */
+    using iterator_type = Iterator;
+
+    /*! @brief Default constructor, explicit on purpose. */
+    explicit SparseSet() noexcept = default;
+
+    /*! @brief Copying a sparse set isn't allowed. */
+    SparseSet(const SparseSet &) = delete;
+    /*! @brief Default move constructor. */
+    SparseSet(SparseSet &&) = default;
+
+    /*! @brief Default destructor. */
+    virtual ~SparseSet() noexcept = default;
+
+    /*! @brief Copying a sparse set isn't allowed. @return This sparse set. */
+    SparseSet & operator=(const SparseSet &) = delete;
+    /*! @brief Default move operator. @return This sparse set. */
+    SparseSet & operator=(SparseSet &&) = default;
+
+    /**
+     * @brief Returns the number of elements in the sparse set.
+     *
+     * The number of elements is also the size of the internal packed array.
+     * There is no guarantee that the internal sparse array has the same size.
+     * Usually the size of the internal sparse array is equal or greater than
+     * the one of the internal packed array.
+     *
+     * @return The number of elements.
+     */
+    size_type size() const noexcept {
+        return direct.size();
+    }
+
+    /**
+     * @brief Checks whether the sparse set is empty.
+     * @return True is the sparse set is empty, false otherwise.
+     */
+    bool empty() const noexcept {
+        return direct.empty();
+    }
+
+    /**
+     * @brief Direct access to the internal packed array.
+     *
+     * The returned pointer is such that range `[data(), data() + size()]` is
+     * always a valid range, even if the container is empty.
+     *
+     * @note
+     * There are no guarantees on the order, even though `sort` has been
+     * previously invoked. Internal data structures arrange elements to maximize
+     * performance. Accessing them directly gives a performance boost but less
+     * guarantees. Use `begin` and `end` if you want to iterate the sparse set
+     * in the expected order.
+     *
+     * @return A pointer to the internal packed array.
+     */
+    const entity_type * data() const noexcept {
+        return direct.data();
+    }
+
+    /**
+     * @brief Returns an iterator to the beginning.
+     *
+     * The returned iterator points to the first element of the internal packed
+     * array. If the sparse set is empty, the returned iterator will be equal to
+     * `end()`.
+     *
+     * @note
+     * Input iterators stay true to the order imposed by a call to `sort`.
+     *
+     * @return An iterator to the first element of the internal packed array.
+     */
+    iterator_type begin() const noexcept {
+        return Iterator{&direct, direct.size()};
+    }
+
+    /**
+     * @brief Returns an iterator to the end.
+     *
+     * The returned iterator points to the element following the last element in
+     * the internal packed array. Attempting to dereference the returned
+     * iterator results in undefined behavior.
+     *
+     * @note
+     * Input iterators stay true to the order imposed by a call to `sort`.
+     *
+     * @return An iterator to the element following the last element of the
+     * internal packed array.
+     */
+    iterator_type end() const noexcept {
+        return Iterator{&direct, 0};
+    }
+
+    /**
+     * @brief Checks if the sparse set contains the given entity.
+     * @param entity A valid entity identifier.
+     * @return True if the sparse set contains the entity, false otherwise.
+     */
+    bool has(entity_type entity) const noexcept {
+        const auto entt = entity & traits_type::entity_mask;
+        return entt < reverse.size() && reverse[entt] < direct.size() && direct[reverse[entt]] == entity;
+    }
+
+    /**
+     * @brief Returns the position of the entity in the sparse set.
+     *
+     * @warning
+     * Attempting to get the position of an entity that doesn't belong to the
+     * sparse set results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set doesn't contain the given entity.
+     *
+     * @param entity A valid entity identifier.
+     * @return The position of the entity in the sparse set.
+     */
+    pos_type get(entity_type entity) const noexcept {
+        assert(has(entity));
+        return reverse[entity & traits_type::entity_mask];
+    }
+
+    /**
+     * @brief Assigns an entity to the sparse set.
+     *
+     * @warning
+     * Attempting to assign an entity that already belongs to the sparse set
+     * results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set already contains the given entity.
+     *
+     * @param entity A valid entity identifier.
+     * @return The position of the entity in the internal packed array.
+     */
+    pos_type construct(entity_type entity) {
+        assert(!has(entity));
+        const auto entt = entity & traits_type::entity_mask;
+
+        if(!(entt < reverse.size())) {
+            reverse.resize(entt+1);
+        }
+
+        const auto pos = pos_type(direct.size());
+        reverse[entt] = pos;
+        direct.emplace_back(entity);
+
+        return pos;
+    }
+
+    /**
+     * @brief Removes the given entity from the sparse set.
+     *
+     * @warning
+     * Attempting to remove an entity that doesn't belong to the sparse set
+     * results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set doesn't contain the given entity.
+     *
+     * @param entity A valid entity identifier.
+     */
+    virtual void destroy(entity_type entity) {
+        assert(has(entity));
+        const auto entt = entity & traits_type::entity_mask;
+        const auto back = direct.back() & traits_type::entity_mask;
+        const auto pos = reverse[entt];
+        reverse[back] = pos;
+        direct[pos] = direct.back();
+        direct.pop_back();
+    }
+
+    /**
+     * @brief Swaps the position of the entities in the internal packed array.
+     *
+     * For what it's worth, this function affects both the internal sparse array
+     * and the internal packed array. Users should not care of that anyway.
+     *
+     * @warning
+     * Attempting to swap entities that don't belong to the sparse set results
+     * in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set doesn't contain the given entities.
+     *
+     * @param lhs A valid entity identifier.
+     * @param rhs A valid entity identifier.
+     */
+    virtual void swap(entity_type lhs, entity_type rhs) {
+        assert(has(lhs));
+        assert(has(rhs));
+        const auto le = lhs & traits_type::entity_mask;
+        const auto re = rhs & traits_type::entity_mask;
+        std::swap(direct[reverse[le]], direct[reverse[re]]);
+        std::swap(reverse[le], reverse[re]);
+    }
+
+    /**
+     * @brief Sort entities according to the given comparison function.
+     *
+     * Sort the elements so that iterating the sparse set with a couple of
+     * iterators returns them in the expected order. See `begin` and `end` for
+     * more details.
+     *
+     * @note
+     * Attempting to iterate elements using the raw pointer returned by `data`
+     * gives no guarantees on the order, even though `sort` has been invoked.
+     *
+     * @tparam Compare The type of the comparison function.
+     * @param compare A comparison function whose signature shall be equivalent
+     * to: `bool(Entity, Entity)`.
+     */
+    template<typename Compare>
+    void sort(Compare compare) {
+        std::vector<pos_type> copy{direct.cbegin(), direct.cend()};
+        std::sort(copy.begin(), copy.end(), [compare = std::move(compare)](auto... args) {
+            return !compare(args...);
+        });
+
+        for(pos_type i = 0; i < copy.size(); ++i) {
+            if(direct[i] != copy[i]) {
+                swap(direct[i], copy[i]);
+            }
+        }
+    }
+
+    /**
+     * @brief Sort entities according to their order in the given sparse set.
+     *
+     * Entities that are part of both the sparse sets are ordered internally
+     * according to the order they have in `other`. All the other entities goes
+     * to the end of the list and there are no guarantess on their order.<br/>
+     * In other terms, this function can be used to impose the same order on two
+     * sets by using one of them as a master and the other one as a slave.
+     *
+     * Iterating the sparse set with a couple of iterators returns elements in
+     * the expected order after a call to `sort`. See `begin` and `end` for more
+     * details.
+     *
+     * @note
+     * Attempting to iterate elements using the raw pointer returned by `data`
+     * gives no guarantees on the order, even though `sort` has been invoked.
+     *
+     * @param other The sparse sets that imposes the order of the entities.
+     */
+    void respect(const SparseSet<Entity> &other) {
+        struct Bool { bool value{false}; };
+        std::vector<Bool> check(std::max(other.reverse.size(), reverse.size()));
+
+        for(auto entity: other.direct) {
+            check[entity & traits_type::entity_mask].value = true;
+        }
+
+        sort([this, &other, &check](auto lhs, auto rhs) {
+            const auto le = lhs & traits_type::entity_mask;
+            const auto re = rhs & traits_type::entity_mask;
+
+            const bool bLhs = check[le].value;
+            const bool bRhs = check[re].value;
+            bool compare = false;
+
+            if(bLhs && bRhs) {
+                compare = other.get(rhs) < other.get(lhs);
+            } else if(!bLhs && !bRhs) {
+                compare = re < le;
+            } else {
+                compare = bLhs;
+            }
+
+            return compare;
+        });
+    }
+
+    /**
+     * @brief Resets the sparse set.
+     */
+    virtual void reset() {
+        reverse.clear();
+        direct.clear();
+    }
+
+private:
+    std::vector<entity_type> reverse;
+    std::vector<entity_type> direct;
+};
+
+
+/**
+ * @brief Extended sparse set implementation.
+ *
+ * This specialization of a sparse set associates an object to an entity. The
+ * main purpose of this class is to use sparse sets to store components in a
+ * Registry. It guarantees fast access both to the elements and to the entities.
+ *
+ * @note
+ * Entities and objects have the same order. It's guaranteed both in case of raw
+ * access (either to entities or objects) and when using input iterators.
+ *
+ * @note
+ * Internal data structures arrange elements to maximize performance. Because of
+ * that, there are no guarantees that elements have the expected order when
+ * iterate directly the internal packed array (see `raw` and `size` member
+ * functions for that). Use `begin` and `end` instead.
+ *
+ * @sa SparseSet<Entity>
+ *
+ * @tparam Entity A valid entity type (see entt_traits for more details).
+ * @tparam Type The type of the objects assigned to the entities.
+ */
+template<typename Entity, typename Type>
+class SparseSet<Entity, Type>: public SparseSet<Entity> {
+    using underlying_type = SparseSet<Entity>;
+
+public:
+    /*! @brief Type of the objects associated to the entities. */
+    using type = Type;
+    /*! @brief Underlying entity identifier. */
+    using entity_type = typename underlying_type::entity_type;
+    /*! @brief Entity dependent position type. */
+    using pos_type = typename underlying_type::pos_type;
+    /*! @brief Unsigned integer type. */
+    using size_type = typename underlying_type::size_type;
+    /*! @brief Input iterator type. */
+    using iterator_type = typename underlying_type::iterator_type;
+
+    /*! @brief Default constructor, explicit on purpose. */
+    explicit SparseSet() noexcept = default;
+
+    /*! @brief Copying a sparse set isn't allowed. */
+    SparseSet(const SparseSet &) = delete;
+    /*! @brief Default move constructor. */
+    SparseSet(SparseSet &&) = default;
+
+    /*! @brief Copying a sparse set isn't allowed. @return This sparse set. */
+    SparseSet & operator=(const SparseSet &) = delete;
+    /*! @brief Default move operator. @return This sparse set. */
+    SparseSet & operator=(SparseSet &&) = default;
+
+    /**
+     * @brief Direct access to the array of objects.
+     *
+     * The returned pointer is such that range `[raw(), raw() + size()]` is
+     * always a valid range, even if the container is empty.
+     *
+     * @note
+     * There are no guarantees on the order, even though `sort` has been
+     * previously invoked. Internal data structures arrange elements to maximize
+     * performance. Accessing them directly gives a performance boost but less
+     * guarantees. Use `begin` and `end` if you want to iterate the sparse set
+     * in the expected order.
+     *
+     * @return A pointer to the array of objects.
+     */
+    const type * raw() const noexcept {
+        return instances.data();
+    }
+
+    /**
+     * @brief Direct access to the array of objects.
+     *
+     * The returned pointer is such that range `[raw(), raw() + size()]` is
+     * always a valid range, even if the container is empty.
+     *
+     * @note
+     * There are no guarantees on the order, even though `sort` has been
+     * previously invoked. Internal data structures arrange elements to maximize
+     * performance. Accessing them directly gives a performance boost but less
+     * guarantees. Use `begin` and `end` if you want to iterate the sparse set
+     * in the expected order.
+     *
+     * @return A pointer to the array of objects.
+     */
+    type * raw() noexcept {
+        return instances.data();
+    }
+
+    /**
+     * @brief Returns the object associated to the given entity.
+     *
+     * @warning
+     * Attempting to use an entity that doesn't belong to the sparse set results
+     * in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set doesn't contain the given entity.
+     *
+     * @param entity A valid entity identifier.
+     * @return The object associated to the entity.
+     */
+    const type & get(entity_type entity) const noexcept {
+        return instances[underlying_type::get(entity)];
+    }
+
+    /**
+     * @brief Returns the object associated to the given entity.
+     *
+     * @warning
+     * Attempting to use an entity that doesn't belong to the sparse set results
+     * in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set doesn't contain the given entity.
+     *
+     * @param entity A valid entity identifier.
+     * @return The object associated to the entity.
+     */
+    type & get(entity_type entity) noexcept {
+        return const_cast<type &>(const_cast<const SparseSet *>(this)->get(entity));
+    }
+
+    /**
+     * @brief Assigns an entity to the sparse set and constructs its object.
+     *
+     * @warning
+     * Attempting to use an entity that already belongs to the sparse set
+     * results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set already contains the given entity.
+     *
+     * @tparam Args The type of the params used to construct the object.
+     * @param entity A valid entity identifier.
+     * @param args The params to use to construct an object for the entity.
+     * @return The object associated to the entity.
+     */
+    template<typename... Args>
+    type & construct(entity_type entity, Args&&... args) {
+        underlying_type::construct(entity);
+        instances.push_back({ std::forward<Args>(args)... });
+        return instances.back();
+    }
+
+    /**
+     * @brief Removes an entity from the sparse set and destroies its object.
+     *
+     * @warning
+     * Attempting to use an entity that doesn't belong to the sparse set results
+     * in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set doesn't contain the given entity.
+     *
+     * @param entity A valid entity identifier.
+     */
+    void destroy(entity_type entity) override {
+        instances[underlying_type::get(entity)] = std::move(instances.back());
+        instances.pop_back();
+        underlying_type::destroy(entity);
+    }
+
+    /**
+     * @brief Swaps the two entities and their objects.
+     *
+     * @note
+     * This function doesn't swap objects between entities. It exchanges entity
+     * and object positions in the sparse set. It's used mainly for sorting.
+     *
+     * @warning
+     * Attempting to use entities that don't belong to the sparse set results
+     * in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * sparse set doesn't contain the given entities.
+     *
+     * @param lhs A valid entity identifier.
+     * @param rhs A valid entity identifier.
+     */
+    void swap(entity_type lhs, entity_type rhs) override {
+        std::swap(instances[underlying_type::get(lhs)], instances[underlying_type::get(rhs)]);
+        underlying_type::swap(lhs, rhs);
+    }
+
+    /**
+     * @brief Resets the sparse set.
+     */
+    void reset() override {
+        underlying_type::reset();
+        instances.clear();
+    }
+
+private:
+    std::vector<type> instances;
+};
+
+
+}
+
+
+#endif // ENTT_ENTITY_SPARSE_SET_HPP

+ 93 - 0
src/entt/entity/traits.hpp

@@ -0,0 +1,93 @@
+#ifndef ENTT_ENTITY_ENTT_HPP
+#define ENTT_ENTITY_ENTT_HPP
+
+
+#include <cstdint>
+
+
+namespace entt {
+
+
+/**
+ * @brief Entity traits.
+ *
+ * Primary template isn't defined on purpose. All the specializations give a
+ * compile-time error unless the template parameter is an accepted entity type.
+ */
+template<typename>
+struct entt_traits;
+
+
+/**
+ * @brief Entity traits for a 16 bits entity identifier.
+ *
+ * A 16 bits entity identifier guarantees:
+ * * 12 bits for the entity number (up to 4k entities).
+ * * 4 bit for the version (resets in [0-15]).
+ */
+template<>
+struct entt_traits<std::uint16_t> {
+    /*! @brief Underlying entity type. */
+    using entity_type = std::uint16_t;
+    /*! @brief Underlying version type. */
+    using version_type = std::uint8_t;
+
+    /*! @brief Mask to use to get the entity number out of an identifier. */
+    static constexpr auto entity_mask = 0xFFF;
+    /*! @brief Mask to use to get the version out of an identifier. */
+    static constexpr auto version_mask = 0xF;
+    /*! @brief Extent of the entity number within an identifier. */
+    static constexpr auto version_shift = 12;
+};
+
+
+/**
+ * @brief Entity traits for a 32 bits entity identifier.
+ *
+ * A 32 bits entity identifier guarantees:
+ * * 24 bits for the entity number (suitable for almost all the games).
+ * * 8 bit for the version (resets in [0-255]).
+ */
+template<>
+struct entt_traits<std::uint32_t> {
+    /*! @brief Underlying entity type. */
+    using entity_type = std::uint32_t;
+    /*! @brief Underlying version type. */
+    using version_type = std::uint16_t;
+
+    /*! @brief Mask to use to get the entity number out of an identifier. */
+    static constexpr auto entity_mask = 0xFFFFFF;
+    /*! @brief Mask to use to get the version out of an identifier. */
+    static constexpr auto version_mask = 0xFF;
+    /*! @brief Extent of the entity number within an identifier. */
+    static constexpr auto version_shift = 24;
+};
+
+
+/**
+ * @brief Entity traits for a 64 bits entity identifier.
+ *
+ * A 64 bits entity identifier guarantees:
+ * * 40 bits for the entity number (an indecently large number).
+ * * 24 bit for the version (an indecently large number).
+ */
+template<>
+struct entt_traits<std::uint64_t> {
+    /*! @brief Underlying entity type. */
+    using entity_type = std::uint64_t;
+    /*! @brief Underlying version type. */
+    using version_type = std::uint32_t;
+
+    /*! @brief Mask to use to get the entity number out of an identifier. */
+    static constexpr auto entity_mask = 0xFFFFFFFFFF;
+    /*! @brief Mask to use to get the version out of an identifier. */
+    static constexpr auto version_mask = 0xFFFFFF;
+    /*! @brief Extent of the entity number within an identifier. */
+    static constexpr auto version_shift = 40;
+};
+
+
+}
+
+
+#endif // ENTT_ENTITY_ENTT_HPP

+ 633 - 0
src/entt/entity/view.hpp

@@ -0,0 +1,633 @@
+#ifndef ENTT_ENTITY_VIEW_HPP
+#define ENTT_ENTITY_VIEW_HPP
+
+
+#include <tuple>
+#include "sparse_set.hpp"
+
+
+namespace entt {
+
+
+/**
+ * @brief Persistent view.
+ *
+ * A persistent view returns all the entities and only the entities that have
+ * at least the given components. Moreover, it's guaranteed that the entity list
+ * is thightly packed in memory for fast iterations.<br/>
+ * In general, persistent views don't stay true to the order of any set of
+ * components unless users explicitly sort them.
+ *
+ * @b Important
+ *
+ * Iterators aren't invalidated if:
+ *
+ * * New instances of the given components are created and assigned to entities.
+ * * The entity currently pointed is modified (as an example, if one of the
+ * given components is removed from the entity to which the iterator points).
+ *
+ * In all the other cases, modify the pools of the given components somehow
+ * invalidates all the iterators and using them results in undefined behavior.
+ *
+ * @note
+ * Views share references to the underlying data structures with the Registry
+ * that generated them. Therefore any change to the entities and to the
+ * components made by means of the registry are immediately reflected by
+ * views.<br/>
+ * Moreover, sorting a persistent view affects all the other views of the same
+ * type (it means that users don't have to call `sort` on each view to sort all
+ * of them because they share the set of entities).
+ *
+ * @warning
+ * Lifetime of a view must overcome the one of the registry that generated it.
+ * In any other case, attempting to use a view results in undefined behavior.
+ *
+ * @sa View
+ * @sa View<Entity, Component>
+ *
+ * @tparam Entity A valid entity type (see entt_traits for more details).
+ * @tparam Component The types of the components iterated by the view.
+ */
+template<typename Entity, typename... Component>
+class PersistentView final {
+    static_assert(sizeof...(Component) > 1, "!");
+
+    template<typename Comp>
+    using pool_type = SparseSet<Entity, Comp>;
+
+    using view_type = SparseSet<Entity>;
+
+public:
+    /*! Input iterator type. */
+    using iterator_type = typename view_type::iterator_type;
+    /*! @brief Underlying entity identifier. */
+    using entity_type = typename view_type::entity_type;
+    /*! @brief Unsigned integer type. */
+    using size_type = typename view_type::size_type;
+
+    /**
+     * @brief Constructs a persistent view around a dedicated pool of entities.
+     *
+     * A persistent view is created out of:
+     * * A dedicated pool of entities that is shared between all the persistent
+     * views of the same type.
+     * * A bunch of pools of components to which to refer to get instances.
+     *
+     * @param view Shared reference to a dedicated pool of entities.
+     * @param pools References to pools of components.
+     */
+    explicit PersistentView(view_type &view, pool_type<Component>&... pools) noexcept
+        : view{view}, pools{pools...}
+    {}
+
+    /**
+     * @brief Returns the number of entities that have the given components.
+     * @return The number of entities that have the given components.
+     */
+    size_type size() const noexcept {
+        return view.size();
+    }
+
+    /**
+     * @brief Direct access to the list of entities.
+     *
+     * The returned pointer is such that range `[data(), data() + size()]` is
+     * always a valid range, even if the container is empty.
+     *
+     * @note
+     * There are no guarantees on the order of the entities. Use `begin` and
+     * `end` if you want to iterate the view in the expected order.
+     *
+     * @return A pointer to the array of entities.
+     */
+    const entity_type * data() const noexcept {
+        return view.data();
+    }
+
+    /**
+     * @brief Returns an iterator to the first entity that has the given
+     * components.
+     *
+     * The returned iterator points to the first entity that has the given
+     * components. If the view is empty, the returned iterator will be equal to
+     * `end()`.
+     *
+     * @note
+     * Input iterators stay true to the order imposed to the underlying data
+     * structures.
+     *
+     * @return An iterator to the first entity that has the given components.
+     */
+    iterator_type begin() const noexcept {
+        return view.begin();
+    }
+
+    /**
+     * @brief Returns an iterator that is past the last entity that has the
+     * given components.
+     *
+     * The returned iterator points to the entity following the last entity that
+     * has the given components. Attempting to dereference the returned iterator
+     * results in undefined behavior.
+     *
+     * @note
+     * Input iterators stay true to the order imposed to the underlying data
+     * structures.
+     *
+     * @return An iterator to the entity following the last entity that has the
+     * given components.
+     */
+    iterator_type end() const noexcept {
+        return view.end();
+    }
+
+    /**
+     * @brief Returns the component assigned to the given entity.
+     *
+     * Prefer this function instead of `Registry::get` during iterations. It has
+     * far better performance than its companion function.
+     *
+     * @warning
+     * Attempting to use an invalid component type results in a compilation
+     * error. Attempting to use an entity that doesn't belong to the view
+     * results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if
+     * the view doesn't contain the given entity.
+     *
+     * @tparam Comp The type of the component to get.
+     * @param entity A valid entity identifier.
+     * @return The component assigned to the entity.
+     */
+    template<typename Comp>
+    const Comp & get(entity_type entity) const noexcept {
+        return std::get<pool_type<Comp> &>(pools).get(entity);
+    }
+
+    /**
+     * @brief Returns the component assigned to the given entity.
+     *
+     * Prefer this function instead of `Registry::get` during iterations.
+     * It has far better performance than its companion function.
+     *
+     * @warning
+     * Attempting to use an invalid component type results in a compilation
+     * error. Attempting to use an entity that doesn't belong to the view
+     * results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if
+     * the view doesn't contain the given entity.
+     *
+     * @tparam Comp The type of the component to get.
+     * @param entity A valid entity identifier.
+     * @return The component assigned to the entity.
+     */
+    template<typename Comp>
+    Comp & get(entity_type entity) noexcept {
+        return const_cast<Comp &>(const_cast<const PersistentView *>(this)->get<Comp>(entity));
+    }
+
+    /**
+     * @brief Sort the shared pool of entities according to the given component.
+     *
+     * Persistent views of the same type share with the Registry a pool of
+     * entities with its own order that doesn't depend on the order of any pool
+     * of components. Users can order the underlying data structure so that it
+     * respects the order of the pool of the given component.
+     *
+     * @note
+     * The shared pool of entities and thus its order is affected by the changes
+     * to each and every pool of components that it tracks. Therefore changes to
+     * the pools of components can quickly ruin the order imposed to the pool of
+     * entities shared between the persistent views.
+     *
+     * @tparam Comp The type of the component to use to impose the order.
+     */
+    template<typename Comp>
+    void sort() {
+        view.respect(std::get<pool_type<Comp> &>(pools));
+    }
+
+private:
+    view_type &view;
+    std::tuple<pool_type<Component> &...> pools;
+};
+
+
+/**
+ * @brief Multi component view.
+ *
+ * Multi component views iterate over those entities that have at least all the
+ * given components in their bags. During initialization, a multi component view
+ * looks at the number of entities available for each component and picks up a
+ * reference to the smallest set of candidate entities in order to get a
+ * performance boost when iterate.<br/>
+ * Order of elements during iterations are highly dependent on the order of the
+ * underlying data strctures. See SparseSet and its specializations for more
+ * details.
+ *
+ * @b Important
+ *
+ * Iterators aren't invalidated if:
+ *
+ * * New instances of the given components are created and assigned to entities.
+ * * The entity currently pointed is modified (as an example, if one of the
+ * given components is removed from the entity to which the iterator points).
+ *
+ * In all the other cases, modify the pools of the given components somehow
+ * invalidates all the iterators and using them results in undefined behavior.
+ *
+ * @note
+ * Views share references to the underlying data structures with the Registry
+ * that generated them. Therefore any change to the entities and to the
+ * components made by means of the registry are immediately reflected by views.
+ *
+ * @warning
+ * Lifetime of a view must overcome the one of the registry that generated it.
+ * In any other case, attempting to use a view results in undefined behavior.
+ *
+ * @sa View<Entity, Component>
+ * @sa PersistentView
+ *
+ * @tparam Entity A valid entity type (see entt_traits for more details).
+ * @tparam First One of the components to iterate.
+ * @tparam Other The rest of the components to iterate.
+ */
+template<typename Entity, typename First, typename... Other>
+class View final {
+    template<typename Component>
+    using pool_type = SparseSet<Entity, Component>;
+
+    using base_pool_type = SparseSet<Entity>;
+    using underlying_iterator_type = typename base_pool_type::iterator_type;
+    using repo_type = std::tuple<pool_type<First> &, pool_type<Other> &...>;
+
+    class Iterator {
+        inline bool valid() const noexcept {
+            using accumulator_type = bool[];
+            auto entity = *begin;
+            bool all = std::get<pool_type<First> &>(pools).has(entity);
+            accumulator_type accumulator =  { (all = all && std::get<pool_type<Other> &>(pools).has(entity))... };
+            (void)accumulator;
+            return all;
+        }
+
+    public:
+        using value_type = typename base_pool_type::entity_type;
+
+        Iterator(const repo_type &pools, underlying_iterator_type begin, underlying_iterator_type end) noexcept
+            : pools{pools}, begin{begin}, end{end}
+        {
+            if(begin != end && !valid()) {
+                ++(*this);
+            }
+        }
+
+        Iterator & operator++() noexcept {
+            ++begin;
+            while(begin != end && !valid()) { ++begin; }
+            return *this;
+        }
+
+        Iterator operator++(int) noexcept {
+            Iterator orig = *this;
+            return ++(*this), orig;
+        }
+
+        bool operator==(const Iterator &other) const noexcept {
+            return other.begin == begin;
+        }
+
+        bool operator!=(const Iterator &other) const noexcept {
+            return !(*this == other);
+        }
+
+        value_type operator*() const noexcept {
+            return *begin;
+        }
+
+    private:
+        const repo_type &pools;
+        underlying_iterator_type begin;
+        underlying_iterator_type end;
+    };
+
+public:
+    /*! Input iterator type. */
+    using iterator_type = Iterator;
+    /*! @brief Underlying entity identifier. */
+    using entity_type = typename base_pool_type::entity_type;
+    /*! @brief Unsigned integer type. */
+    using size_type = typename base_pool_type::size_type;
+
+    /**
+     * @brief Constructs a view out of a bunch of pools of components.
+     * @param pool A reference to a pool of components.
+     * @param other Other references to pools of components.
+     */
+    explicit View(pool_type<First> &pool, pool_type<Other>&... other) noexcept
+        : pools{pool, other...}, view{nullptr}
+    {
+        reset();
+    }
+
+    /**
+     * @brief Returns an iterator to the first entity that has the given
+     * components.
+     *
+     * The returned iterator points to the first entity that has the given
+     * components. If the view is empty, the returned iterator will be equal to
+     * `end()`.
+     *
+     * @note
+     * Input iterators stay true to the order imposed to the underlying data
+     * structures.
+     *
+     * @return An iterator to the first entity that has the given components.
+     */
+    iterator_type begin() const noexcept {
+        return Iterator{pools, view->begin(), view->end()};
+    }
+
+    /**
+     * @brief Returns an iterator that is past the last entity that has the
+     * given components.
+     *
+     * The returned iterator points to the entity following the last entity that
+     * has the given components. Attempting to dereference the returned iterator
+     * results in undefined behavior.
+     *
+     * @note
+     * Input iterators stay true to the order imposed to the underlying data
+     * structures.
+     *
+     * @return An iterator to the entity following the last entity that has the
+     * given components.
+     */
+    iterator_type end() const noexcept {
+        return Iterator{pools, view->end(), view->end()};
+    }
+
+    /**
+     * @brief Returns the component assigned to the given entity.
+     *
+     * Prefer this function instead of `Registry::get` during iterations.
+     * It has far better performance than its companion function.
+     *
+     * @warning
+     * Attempting to use an invalid component type results in a compilation
+     * error. Attempting to use an entity that doesn't belong to the view
+     * results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if
+     * the view doesn't contain the given entity.
+     *
+     * @tparam Component The type of the component to get.
+     * @param entity A valid entity identifier.
+     * @return The component assigned to the entity.
+     */
+    template<typename Component>
+    const Component & get(entity_type entity) const noexcept {
+        return std::get<pool_type<Component> &>(pools).get(entity);
+    }
+
+    /**
+     * @brief Returns the component assigned to the given entity.
+     *
+     * Prefer this function instead of `Registry::get` during iterations. It has
+     * far better performance than its companion function.
+     *
+     * @warning
+     * Attempting to use an invalid component type results in a compilation
+     * error. Attempting to use an entity that doesn't belong to the view
+     * results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if
+     * the view doesn't contain the given entity.
+     *
+     * @tparam Component The type of the component to get.
+     * @param entity A valid entity identifier.
+     * @return The component assigned to the entity.
+     */
+    template<typename Component>
+    Component & get(entity_type entity) noexcept {
+        return const_cast<Component &>(const_cast<const View *>(this)->get<Component>(entity));
+    }
+
+    /**
+     * @brief Resets the view and reinitializes it.
+     *
+     * A multi component view keeps a reference to the smallest set of candidate
+     * entities to iterate. Resetting a view means querying the underlying data
+     * structures and reinitializing the view.<br/>
+     * Use it only if copies of views are stored around and there is a
+     * possibility that a component has become the best candidate in the
+     * meantime.
+     */
+    void reset() {
+        using accumulator_type = void *[];
+        view = &std::get<pool_type<First> &>(pools);
+        accumulator_type accumulator = { (std::get<pool_type<Other> &>(pools).size() < view->size() ? (view = &std::get<pool_type<Other> &>(pools)) : nullptr)... };
+        (void)accumulator;
+    }
+
+private:
+    repo_type pools;
+    base_pool_type *view;
+};
+
+
+/**
+ * @brief Single component view specialization.
+ *
+ * Single component views are specialized in order to get a boost in terms of
+ * performance. This kind of views can access the underlying data structure
+ * directly and avoid superflous checks.<br/>
+ * Order of elements during iterations are highly dependent on the order of the
+ * underlying data structure. See SparseSet and its specializations for more
+ * details.
+ *
+ * @b Important
+ *
+ * Iterators aren't invalidated if:
+ *
+ * * New instances of the given components are created and assigned to entities.
+ * * The entity currently pointed is modified (as an example, if one of the
+ * given components is removed from the entity to which the iterator points).
+ *
+ * In all the other cases, modify the pools of the given components somehow
+ * invalidates all the iterators and using them results in undefined behavior.
+ *
+ * @note
+ * Views share a reference to the underlying data structure with the Registry
+ * that generated them. Therefore any change to the entities and to the
+ * components made by means of the registry are immediately reflected by views.
+ *
+ * @warning
+ * Lifetime of a view must overcome the one of the registry that generated it.
+ * In any other case, attempting to use a view results in undefined behavior.
+ *
+ * @sa View
+ * @sa PersistentView
+ *
+ * @tparam Entity A valid entity type (see entt_traits for more details).
+ * @tparam Component The type of the component iterated by the view.
+ */
+template<typename Entity, typename Component>
+class View<Entity, Component> final {
+    using pool_type = SparseSet<Entity, Component>;
+
+public:
+    /*! Input iterator type. */
+    using iterator_type = typename pool_type::iterator_type;
+    /*! @brief Underlying entity identifier. */
+    using entity_type = typename pool_type::entity_type;
+    /*! @brief Unsigned integer type. */
+    using size_type = typename pool_type::size_type;
+    /*! The type of the component iterated by the view. */
+    using raw_type = typename pool_type::type;
+
+    /**
+     * @brief Constructs a view out of a pool of components.
+     * @param pool A reference to a pool of components.
+     */
+    explicit View(pool_type &pool) noexcept
+        : pool{pool}
+    {}
+
+    /**
+     * @brief Returns the number of entities that have the given component.
+     * @return The number of entities that have the given component.
+     */
+    size_type size() const noexcept {
+        return pool.size();
+    }
+
+    /**
+     * @brief Direct access to the list of components.
+     *
+     * The returned pointer is such that range `[raw(), raw() + size()]` is
+     * always a valid range, even if the container is empty.
+     *
+     * @note
+     * There are no guarantees on the order of the components. Use `begin` and
+     * `end` if you want to iterate the view in the expected order.
+     *
+     * @return A pointer to the array of components.
+     */
+    raw_type * raw() noexcept {
+        return pool.raw();
+    }
+
+    /**
+     * @brief Direct access to the list of components.
+     *
+     * The returned pointer is such that range `[raw(), raw() + size()]` is
+     * always a valid range, even if the container is empty.
+     *
+     * @note
+     * There are no guarantees on the order of the components. Use `begin` and
+     * `end` if you want to iterate the view in the expected order.
+     *
+     * @return A pointer to the array of components.
+     */
+    const raw_type * raw() const noexcept {
+        return pool.raw();
+    }
+
+    /**
+     * @brief Direct access to the list of entities.
+     *
+     * The returned pointer is such that range `[data(), data() + size()]` is
+     * always a valid range, even if the container is empty.
+     *
+     * @note
+     * There are no guarantees on the order of the entities. Use `begin` and
+     * `end` if you want to iterate the view in the expected order.
+     *
+     * @return A pointer to the array of entities.
+     */
+    const entity_type * data() const noexcept {
+        return pool.data();
+    }
+
+    /**
+     * @brief Returns an iterator to the first entity that has the given
+     * component.
+     *
+     * The returned iterator points to the first entity that has the given
+     * component. If the view is empty, the returned iterator will be equal to
+     * `end()`.
+     *
+     * @note
+     * Input iterators stay true to the order imposed to the underlying data
+     * structures.
+     *
+     * @return An iterator to the first entity that has the given component.
+     */
+    iterator_type begin() const noexcept {
+        return pool.begin();
+    }
+
+    /**
+     * @brief Returns an iterator that is past the last entity that has the
+     * given component.
+     *
+     * The returned iterator points to the entity following the last entity that
+     * has the given component. Attempting to dereference the returned iterator
+     * results in undefined behavior.
+     *
+     * @note
+     * Input iterators stay true to the order imposed to the underlying data
+     * structures.
+     *
+     * @return An iterator to the entity following the last entity that has the
+     * given component.
+     */
+    iterator_type end() const noexcept {
+        return pool.end();
+    }
+
+    /**
+     * @brief Returns the component assigned to the given entity.
+     *
+     * Prefer this function instead of `Registry::get` during iterations. It has
+     * far better performance than its companion function.
+     *
+     * @warning
+     * Attempting to use an entity that doesn't belong to the view results in
+     * undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * view doesn't contain the given entity.
+     *
+     * @param entity A valid entity identifier.
+     * @return The component assigned to the entity.
+     */
+    const Component & get(entity_type entity) const noexcept {
+        return pool.get(entity);
+    }
+
+    /**
+     * @brief Returns the component assigned to the given entity.
+     *
+     * Prefer this function instead of `Registry::get` during iterations. It has
+     * far better performance than its companion function.
+     *
+     * @warning
+     * Attempting to use an entity that doesn't belong to the view results in
+     * undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode if the
+     * view doesn't contain the given entity.
+     *
+     * @param entity A valid entity identifier.
+     * @return The component assigned to the entity.
+     */
+    Component & get(entity_type entity) noexcept {
+        return const_cast<Component &>(const_cast<const View *>(this)->get(entity));
+    }
+
+private:
+    pool_type &pool;
+};
+
+
+}
+
+
+#endif // ENTT_ENTITY_VIEW_HPP

+ 7 - 0
src/entt/entt.hpp

@@ -0,0 +1,7 @@
+#include "core/family.hpp"
+#include "core/ident.hpp"
+#include "entity/registry.hpp"
+#include "entity/sparse_set.hpp"
+#include "entity/traits.hpp"
+#include "entity/view.hpp"
+#include "signal/sigh.hpp"

+ 348 - 0
src/entt/signal/sigh.hpp

@@ -0,0 +1,348 @@
+#ifndef ENTT_SIGNAL_SIGH_HPP
+#define ENTT_SIGNAL_SIGH_HPP
+
+
+#include <algorithm>
+#include <utility>
+#include <vector>
+
+
+namespace entt {
+
+
+namespace {
+
+
+template<typename, typename>
+struct Invoker;
+
+
+template<typename Ret, typename... Args, typename Collector>
+struct Invoker<Ret(Args...), Collector> {
+    using proto_type = Ret(*)(void *, Args...);
+    using call_type = std::pair<void *, proto_type>;
+
+    virtual ~Invoker() = default;
+
+    template<typename SFINAE = Ret>
+    typename std::enable_if<std::is_void<SFINAE>::value, bool>::type
+    invoke(Collector &, proto_type proto, void *instance, Args... args) {
+        proto(instance, args...);
+        return true;
+    }
+
+    template<typename SFINAE = Ret>
+    typename std::enable_if<!std::is_void<SFINAE>::value, bool>::type
+    invoke(Collector &collector, proto_type proto, void *instance, Args... args) {
+        return collector(proto(instance, args...));
+    }
+};
+
+
+template<typename Ret>
+struct NullCollector final {
+    using result_type = Ret;
+    bool operator()(result_type) const noexcept { return true; }
+};
+
+
+template<>
+struct NullCollector<void> final {
+    using result_type = void;
+    bool operator()() const noexcept { return true; }
+};
+
+
+template<typename>
+struct DefaultCollector;
+
+
+template<typename Ret, typename... Args>
+struct DefaultCollector<Ret(Args...)> final {
+    using collector_type = NullCollector<Ret>;
+};
+
+
+template<typename Function>
+using DefaultCollectorType = typename DefaultCollector<Function>::collector_type;
+
+
+}
+
+
+/**
+ * @brief Signal handler.
+ *
+ * Primary template isn't defined on purpose. All the specializations give a
+ * compile-time error unless the template parameter is a function type.
+ */
+template<typename Function, typename = DefaultCollectorType<Function>>
+class SigH;
+
+
+/**
+ * @brief Signal handler.
+ *
+ * Unmanaged signal handler. It works directly with naked pointers to classes
+ * and pointers to member functions as well as pointers to free functions. Users
+ * of this class are in charge of disconnecting instances before deleting them.
+ *
+ * This class serves mainly two purposes:
+ * * Creating signals to be used later to notify a bunch of listeners.
+ * * Collecting results from a set of functions like in a voting system.
+ *
+ * The default collector does nothing. To properly collect data, define and use
+ * a class that has a call operator the signature of which is `bool(Param)` and:
+ * * `Param` is a type to which `Ret` can be converted.
+ * * The return type is true if the handler must stop collecting data, false
+ *   otherwise.
+ *
+ * @tparam Ret Return type of a function type.
+ * @tparam Args Types of the arguments of a function type.
+ * @tparam Collector The type of the collector to use if any.
+ */
+template<typename Ret, typename... Args, typename Collector>
+class SigH<Ret(Args...), Collector> final: private Invoker<Ret(Args...), Collector> {
+    using typename Invoker<Ret(Args...), Collector>::call_type;
+
+    template<Ret(*Function)(Args...)>
+    static Ret proto(void *, Args... args) {
+        return (Function)(args...);
+    }
+
+    template<typename Class, Ret(Class::*Member)(Args... args)>
+    static Ret proto(void *instance, Args... args) {
+        return (static_cast<Class *>(instance)->*Member)(args...);
+    }
+
+public:
+    /*! @brief Unsigned integer type. */
+    using size_type = typename std::vector<call_type>::size_type;
+    /*! @brief Collector type. */
+    using collector_type = Collector;
+
+    /*! @brief Default constructor, explicit on purpose. */
+    explicit SigH() noexcept = default;
+
+    /*! @brief Default destructor. */
+    ~SigH() noexcept = default;
+
+    /**
+     * @brief Copy constructor, listeners are also connected to this signal.
+     * @param other A signal to be used as source to initialize this instance.
+     */
+    SigH(const SigH &other)
+        : calls{other.calls}
+    {}
+
+    /**
+     * @brief Default move constructor.
+     * @param other A signal to be used as source to initialize this instance.
+     */
+    SigH(SigH &&other): SigH{} {
+        swap(*this, other);
+    }
+
+    /**
+     * @brief Assignment operator, listeners are also connected to this signal.
+     * @param other A signal to be used as source to initialize this instance.
+     * @return This signal.
+     */
+    SigH & operator=(const SigH &other) {
+        calls = other.calls;
+        return *this;
+    }
+
+    /**
+     * @brief Default move operator.
+     * @param other A signal to be used as source to initialize this instance.
+     * @return This signal.
+     */
+    SigH & operator=(SigH &&other) {
+        swap(*this, other);
+        return *this;
+    }
+
+    /**
+     * @brief The number of listeners connected to the signal.
+     * @return The number of listeners currently connected.
+     */
+    size_type size() const noexcept {
+        return calls.size();
+    }
+
+    /**
+     * @brief Returns true is at least a listener is connected to the signal.
+     * @return True if the signal has no listeners connected, false otherwise.
+     */
+    bool empty() const noexcept {
+        return calls.empty();
+    }
+
+    /**
+     * @brief Disconnects all the listeners from the signal.
+     */
+    void clear() noexcept {
+        calls.clear();
+    }
+
+    /**
+     * @brief Connects a free function to the signal.
+     *
+     * @note
+     * The signal handler performs checks to avoid multiple connections for free
+     * functions.
+     *
+     * @tparam Function A valid free function pointer.
+     */
+    template<Ret(*Function)(Args...)>
+    void connect() {
+        disconnect<Function>();
+        calls.emplace_back(nullptr, &proto<Function>);
+    }
+
+    /**
+     * @brief Connects the member function for the given instance to the signal.
+     *
+     * The signal isn't responsible for the connected object. Users must
+     * guarantee that the lifetime of the instance overcomes the one of the
+     * signal.
+     *
+     * @warning
+     * The signal handler performs checks to avoid multiple connections for the
+     * same member function of a given instance.
+     *
+     * @tparam Class The type of the class to which the member function belongs.
+     * @tparam Member The member function to connect to the signal.
+     * @param instance A valid instance of type pointer to `Class`.
+     */
+    template <typename Class, Ret(Class::*Member)(Args...)>
+    void connect(Class *instance) {
+        disconnect<Class, Member>(instance);
+        calls.emplace_back(instance, &proto<Class, Member>);
+    }
+
+    /**
+     * @brief Disconnects a free function from the signal.
+     * @tparam Function A valid free function pointer.
+     */
+    template<Ret(*Function)(Args...)>
+    void disconnect() {
+        call_type target{nullptr, &proto<Function>};
+        calls.erase(std::remove(calls.begin(), calls.end(), std::move(target)), calls.end());
+    }
+
+    /**
+     * @brief Disconnects the given member function from the signal.
+     * @tparam Class The type of the class to which the member function belongs.
+     * @tparam Member The member function to connect to the signal.
+     * @param instance A valid instance of type pointer to `Class`.
+     */
+    template<typename Class, Ret(Class::*Member)(Args...)>
+    void disconnect(Class *instance) {
+        call_type target{instance, &proto<Class, Member>};
+        calls.erase(std::remove(calls.begin(), calls.end(), std::move(target)), calls.end());
+    }
+
+    /**
+     * @brief Removes all existing connections for the given instance.
+     * @tparam Class The type of the class to which the member function belongs.
+     * @param instance A valid instance of type pointer to `Class`.
+     */
+    template<typename Class>
+    void disconnect(Class *instance) {
+        auto func = [instance](const call_type &call) { return call.first == instance; };
+        calls.erase(std::remove_if(calls.begin(), calls.end(), std::move(func)), calls.end());
+    }
+
+    /**
+     * @brief Triggers the signal.
+     *
+     * All the listeners are notified. Order isn't guaranteed.
+     *
+     * @param args Arguments to use to invoke listeners.
+     */
+    void publish(Args... args) {
+        for(auto &&call: calls) {
+            call.second(call.first, args...);
+        }
+    }
+
+    /**
+     * @brief Collects return values from the listeners.
+     * @param args Arguments to use to invoke listeners.
+     * @return An instance of the collector filled with collected data.
+     */
+    collector_type collect(Args... args) {
+        collector_type collector;
+
+        for(auto &&call: calls) {
+            if(!this->invoke(collector, call.second, call.first, args...)) {
+                break;
+            }
+        }
+
+        return collector;
+    }
+
+    /**
+     * @brief Swaps listeners between the two signals.
+     * @param lhs A valid signal object.
+     * @param rhs A valid signal object.
+     */
+    friend void swap(SigH &lhs, SigH &rhs) {
+        using std::swap;
+        swap(lhs.calls, rhs.calls);
+    }
+
+    /**
+     * @brief Checks if the contents of the two signals are identical.
+     *
+     * Two signals are identical if they have the same size and the same
+     * listeners registered exactly in the same order.
+     *
+     * @param other Signal with which to compare.
+     * @return True if the two signals are identical, false otherwise.
+     */
+    bool operator==(const SigH &other) const noexcept {
+        return (calls.size() == other.calls.size()) && std::equal(calls.cbegin(), calls.cend(), other.calls.cbegin());
+    }
+
+private:
+    std::vector<call_type> calls;
+};
+
+
+/**
+ * @brief Checks if the contents of the two signals are different.
+ *
+ * Two signals are identical if they have the same size and the same
+ * listeners registered exactly in the same order.
+ *
+ * @tparam Ret Return type of a function type.
+ * @tparam Args Types of the arguments of a function type.
+ * @param lhs A valid signal object.
+ * @param rhs A valid signal object.
+ * @return True if the two signals are different, false otherwise.
+ */
+template<typename Ret, typename... Args>
+bool operator!=(const SigH<Ret(Args...)> &lhs, const SigH<Ret(Args...)> &rhs) noexcept {
+    return !(lhs == rhs);
+}
+
+
+/**
+ * @brief Event handler.
+ *
+ * Unmanaged event handler. Collecting data for this kind of signals doesn't
+ * make sense at all. Its sole purpose is to provide the listeners with the
+ * given event.
+ */
+template<typename Event>
+using EventH = SigH<void(const Event &)>;
+
+
+}
+
+
+#endif // ENTT_SIGNAL_SIGH_HPP

+ 0 - 43
src/ident.hpp

@@ -1,43 +0,0 @@
-#ifndef ENTT_IDENT_HPP
-#define ENTT_IDENT_HPP
-
-
-#include<type_traits>
-#include<cstddef>
-#include<utility>
-
-
-namespace entt {
-
-
-namespace details {
-
-
-template<typename Type>
-struct Wrapper {
-    using type = Type;
-    constexpr Wrapper(std::size_t index): index{index} {}
-    const std::size_t index;
-};
-
-template<typename... Types>
-struct Identifier final: Wrapper<Types>... {
-    template<std::size_t... Indexes>
-    constexpr Identifier(std::index_sequence<Indexes...>): Wrapper<Types>{Indexes}... {}
-
-    template<typename Type>
-    constexpr std::size_t get() const { return Wrapper<std::decay_t<Type>>::index; }
-};
-
-
-}
-
-
-template<typename... Types>
-constexpr auto ident = details::Identifier<std::decay_t<Types>...>{std::make_index_sequence<sizeof...(Types)>{}};
-
-
-}
-
-
-#endif // ENTT_IDENT_HPP

+ 0 - 443
src/registry.hpp

@@ -1,443 +0,0 @@
-#ifndef ENTT_REGISTRY_HPP
-#define ENTT_REGISTRY_HPP
-
-
-#include <tuple>
-#include <vector>
-#include <bitset>
-#include <utility>
-#include <cstddef>
-#include <cassert>
-#include <type_traits>
-#include "sparse_set.hpp"
-#include "ident.hpp"
-
-
-namespace entt {
-
-
-template<typename, std::size_t...>
-class View;
-
-
-template<typename Pool, std::size_t Ident, std::size_t... Other>
-class View<Pool, Ident, Other...> final {
-    using pool_type = Pool;
-    using mask_type = std::bitset<std::tuple_size<Pool>::value + 1>;
-    using underlying_iterator_type = typename std::tuple_element_t<Ident, Pool>::iterator_type;
-
-    class ViewIterator;
-
-public:
-    using iterator_type = ViewIterator;
-    using entity_type = typename std::tuple_element_t<Ident, Pool>::index_type;
-    using size_type = typename std::tuple_element_t<Ident, Pool>::size_type;
-
-private:
-    class ViewIterator {
-        inline bool valid() const noexcept {
-            return ((mask[*begin] & bitmask) == bitmask);
-        }
-
-    public:
-        using value_type = entity_type;
-
-        ViewIterator(underlying_iterator_type begin, underlying_iterator_type end, const mask_type &bitmask, const mask_type *mask) noexcept
-            : begin{begin}, end{end}, bitmask{bitmask}, mask{mask}
-        {
-            if(begin != end && !valid()) {
-                ++(*this);
-            }
-        }
-
-        ViewIterator & operator++() noexcept {
-            ++begin;
-            while(begin != end && !valid()) { ++begin; }
-            return *this;
-        }
-
-        ViewIterator operator++(int) noexcept {
-            ViewIterator orig = *this;
-            return ++(*this), orig;
-        }
-
-        bool operator==(const ViewIterator &other) const noexcept {
-            return other.begin == begin;
-        }
-
-        bool operator!=(const ViewIterator &other) const noexcept {
-            return !(*this == other);
-        }
-
-        value_type operator*() const noexcept {
-            return *begin;
-        }
-
-    private:
-        underlying_iterator_type begin;
-        underlying_iterator_type end;
-        const mask_type bitmask;
-        const mask_type *mask;
-    };
-
-    template<std::size_t Idx>
-    void prefer(size_type &size) noexcept {
-        auto &&cpool = std::get<Idx>(*pool);
-        auto sz = cpool.size();
-
-        if(sz < size) {
-            from = cpool.begin();
-            to = cpool.end();
-            size = sz;
-        }
-    }
-
-public:
-    explicit View(const pool_type *pool, const mask_type *mask) noexcept
-        : from{std::get<Ident>(*pool).begin()},
-          to{std::get<Ident>(*pool).end()},
-          pool{pool},
-          mask{mask}
-    {
-        using accumulator_type = int[];
-        size_type size = std::get<Ident>(*pool).size();
-        bitmask.set(Ident);
-        accumulator_type types = { 0, (bitmask.set(Other), 0)... };
-        accumulator_type pref = { 0, (prefer<Other>(size), 0)... };
-        (void)types, (void)pref;
-    }
-
-    iterator_type begin() const noexcept {
-        return ViewIterator{from, to, bitmask, mask};
-    }
-
-    iterator_type end() const noexcept {
-        return ViewIterator{to, to, bitmask, mask};
-    }
-
-    void reset() noexcept {
-        using accumulator_type = int[];
-        auto &&cpool = std::get<Ident>(*pool);
-        from = cpool.begin();
-        to = cpool.end();
-        size_type size = cpool.size();
-        accumulator_type accumulator = { 0, (prefer<Other>(size), 0)... };
-        (void)accumulator;
-    }
-
-private:
-    underlying_iterator_type from;
-    underlying_iterator_type to;
-    const pool_type *pool;
-    const mask_type *mask;
-    mask_type bitmask;
-};
-
-
-template<typename Pool, std::size_t Ident>
-class View<Pool, Ident> final {
-    using pool_type = std::tuple_element_t<Ident, Pool>;
-
-public:
-    using iterator_type = typename pool_type::iterator_type;
-    using entity_type = typename pool_type::index_type;
-    using size_type = typename pool_type::size_type;
-    using raw_type = typename pool_type::type;
-
-    explicit View(const Pool *pool) noexcept
-        : pool{&std::get<Ident>(*pool)}
-    {}
-
-    raw_type * raw() noexcept {
-        return pool->raw();
-    }
-
-    const raw_type * raw() const noexcept {
-        return pool->raw();
-    }
-
-    const entity_type * data() const noexcept {
-        return pool->data();
-    }
-
-    size_type size() const noexcept {
-        return pool->size();
-    }
-
-    iterator_type begin() const noexcept {
-        return pool->begin();
-    }
-
-    iterator_type end() const noexcept {
-        return pool->end();
-    }
-
-private:
-    const pool_type *pool;
-};
-
-
-template<typename Entity, typename... Component>
-class Registry {
-    using pool_type = std::tuple<SparseSet<Entity, Component>...>;
-    using mask_type = std::bitset<sizeof...(Component)+1>;
-
-    static constexpr auto validity_bit = sizeof...(Component);
-
-    // variable templates are fine as well, but for the fact that MSVC goes crazy
-    template<typename Comp>
-    struct identifier {
-        static constexpr auto value = ident<Component...>.template get<Comp>();
-    };
-
-public:
-    using entity_type = Entity;
-    using size_type = typename std::vector<mask_type>::size_type;
-
-    template<typename... Comp>
-    using view_type = View<pool_type, identifier<Comp>::value...>;
-
-private:
-    template<typename Comp>
-    void clone(entity_type to, entity_type from) {
-        if(entities[from].test(identifier<Comp>::value)) {
-            assign<Comp>(to, std::get<identifier<Comp>::value>(pool).get(from));
-        }
-    }
-
-    template<typename Comp>
-    void sync(entity_type to, entity_type from) {
-        bool src = entities[from].test(identifier<Comp>::value);
-        bool dst = entities[to].test(identifier<Comp>::value);
-
-        if(src && dst) {
-            copy<Comp>(to, from);
-        } else if(src) {
-            clone<Comp>(to, from);
-        } else if(dst) {
-            remove<Comp>(to);
-        }
-    }
-
-public:
-    explicit Registry() = default;
-    ~Registry() = default;
-
-    Registry(const Registry &) = delete;
-    Registry(Registry &&) = delete;
-
-    Registry & operator=(const Registry &) = delete;
-    Registry & operator=(Registry &&) = delete;
-
-    template<typename Comp>
-    size_type size() const noexcept {
-        return std::get<identifier<Comp>::value>(pool).size();
-    }
-
-    size_type size() const noexcept {
-        return entities.size() - available.size();
-    }
-
-    template<typename Comp>
-    size_type capacity() const noexcept {
-        return std::get<identifier<Comp>::value>(pool).capacity();
-    }
-
-    size_type capacity() const noexcept {
-        return entities.size();
-    }
-
-    template<typename Comp>
-    bool empty() const noexcept {
-        return std::get<identifier<Comp>::value>(pool).empty();
-    }
-
-    bool empty() const noexcept {
-        return entities.empty();
-    }
-
-    bool valid(entity_type entity) const noexcept {
-        return (entity < entities.size() && entities[entity].test(validity_bit));
-    }
-
-    template<typename... Comp>
-    entity_type create() noexcept {
-        using accumulator_type = int[];
-        auto entity = create();
-        accumulator_type accumulator = { 0, (assign<Comp>(entity), 0)... };
-        (void)accumulator;
-        return entity;
-    }
-
-    entity_type create() noexcept {
-        entity_type entity;
-
-        if(available.empty()) {
-            entity = entity_type(entities.size());
-            entities.emplace_back();
-        } else {
-            entity = available.back();
-            available.pop_back();
-        }
-
-        entities[entity].set(validity_bit);
-
-        return entity;
-    }
-
-    void destroy(entity_type entity) {
-        assert(valid(entity));
-        using accumulator_type = int[];
-        accumulator_type accumulator = { 0, (reset<Component>(entity), 0)... };
-        available.push_back(entity);
-        entities[entity].reset();
-        (void)accumulator;
-    }
-
-    template<typename Comp, typename... Args>
-    Comp & assign(entity_type entity, Args... args) {
-        assert(valid(entity));
-        entities[entity].set(identifier<Comp>::value);
-        return std::get<identifier<Comp>::value>(pool).construct(entity, args...);
-    }
-
-    template<typename Comp>
-    void remove(entity_type entity) {
-        assert(valid(entity));
-        entities[entity].reset(identifier<Comp>::value);
-        std::get<identifier<Comp>::value>(pool).destroy(entity);
-    }
-
-    template<typename... Comp>
-    bool has(entity_type entity) const noexcept {
-        assert(valid(entity));
-        using accumulator_type = bool[];
-        bool all = true;
-        auto &mask = entities[entity];
-        accumulator_type accumulator = { true, (all = all && mask.test(identifier<Comp>::value))... };
-        (void)accumulator;
-        return all;
-    }
-
-    template<typename Comp>
-    const Comp & get(entity_type entity) const noexcept {
-        assert(valid(entity));
-        return std::get<identifier<Comp>::value>(pool).get(entity);
-    }
-
-    template<typename Comp>
-    Comp & get(entity_type entity) noexcept {
-        assert(valid(entity));
-        return std::get<identifier<Comp>::value>(pool).get(entity);
-    }
-
-    template<typename Comp, typename... Args>
-    Comp & replace(entity_type entity, Args... args) {
-        assert(valid(entity));
-        return (std::get<identifier<Comp>::value>(pool).get(entity) = Comp{args...});
-    }
-
-    template<typename Comp, typename... Args>
-    Comp & accomodate(entity_type entity, Args... args) {
-        assert(valid(entity));
-
-        return (entities[entity].test(identifier<Comp>::value)
-                ? this->template replace<Comp>(entity, std::forward<Args>(args)...)
-                : this->template assign<Comp>(entity, std::forward<Args>(args)...));
-    }
-
-    entity_type clone(entity_type from) {
-        assert(valid(from));
-        using accumulator_type = int[];
-        auto to = create();
-        accumulator_type accumulator = { 0, (clone<Component>(to, from), 0)... };
-        (void)accumulator;
-        return to;
-    }
-
-    template<typename Comp>
-    Comp & copy(entity_type to, entity_type from) {
-        assert(valid(to));
-        assert(valid(from));
-        auto &&cpool = std::get<identifier<Comp>::value>(pool);
-        return (cpool.get(to) = cpool.get(from));
-    }
-
-    void copy(entity_type to, entity_type from) {
-        assert(valid(to));
-        assert(valid(from));
-        using accumulator_type = int[];
-        accumulator_type accumulator = { 0, (sync<Component>(to, from), 0)... };
-        (void)accumulator;
-    }
-
-    template<typename Comp>
-    void swap(entity_type lhs, entity_type rhs) {
-        assert(valid(lhs));
-        assert(valid(rhs));
-        std::get<identifier<Comp>::value>(pool).swap(lhs, rhs);
-    }
-
-    template<typename Comp, typename Compare>
-    void sort(Compare compare) {
-        std::get<identifier<Comp>::value>(pool).sort(std::move(compare));
-    }
-
-    template<typename To, typename From>
-    void sort() {
-        auto &&to = std::get<identifier<To>::value>(pool);
-        auto &&from = std::get<identifier<From>::value>(pool);
-        to.respect(from);
-    }
-
-    template<typename Comp>
-    void reset(entity_type entity) {
-        assert(valid(entity));
-
-        if(entities[entity].test(identifier<Comp>::value)) {
-            remove<Comp>(entity);
-        }
-    }
-
-    template<typename Comp>
-    void reset() {
-        for(entity_type entity = 0, last = entity_type(entities.size()); entity < last; ++entity) {
-            if(entities[entity].test(identifier<Comp>::value)) {
-                remove<Comp>(entity);
-            }
-        }
-    }
-
-    void reset() {
-        using accumulator_type = int[];
-        accumulator_type acc = { 0, (std::get<identifier<Component>::value>(pool).reset(), 0)... };
-        entities.clear();
-        available.clear();
-        (void)acc;
-    }
-
-    template<typename... Comp>
-    // view_type<Comp...> is fine as well, but for the fact that MSVC dislikes it
-    std::enable_if_t<(sizeof...(Comp) == 1), View<pool_type, identifier<Comp>::value...>>
-    view() noexcept { return view_type<Comp...>{&pool}; }
-
-    template<typename... Comp>
-    // view_type<Comp...> is fine as well, but for the fact that MSVC dislikes it
-    std::enable_if_t<(sizeof...(Comp) > 1), View<pool_type, identifier<Comp>::value...>>
-    view() noexcept { return view_type<Comp...>{&pool, entities.data()}; }
-
-private:
-    std::vector<mask_type> entities;
-    std::vector<entity_type> available;
-    pool_type pool;
-};
-
-
-template<typename... Component>
-using DefaultRegistry = Registry<std::uint32_t, Component...>;
-
-
-}
-
-
-#endif // ENTT_REGISTRY_HPP

+ 0 - 277
src/sparse_set.hpp

@@ -1,277 +0,0 @@
-#ifndef ENTT_COMPONENT_POOL_HPP
-#define ENTT_COMPONENT_POOL_HPP
-
-
-#include <algorithm>
-#include <utility>
-#include <numeric>
-#include <vector>
-#include <cstddef>
-#include <cassert>
-
-
-namespace entt {
-
-
-template<typename...>
-class SparseSet;
-
-
-template<typename Index>
-class SparseSet<Index> {
-    struct SparseSetIterator;
-
-public:
-    using index_type = Index;
-    using pos_type = index_type;
-    using size_type = std::size_t;
-    using iterator_type = SparseSetIterator;
-
-private:
-    struct SparseSetIterator {
-        using value_type = index_type;
-
-        SparseSetIterator(const std::vector<index_type> *direct, size_type pos)
-            : direct{direct}, pos{pos}
-        {}
-
-        SparseSetIterator & operator++() noexcept {
-            return --pos, *this;
-        }
-
-        SparseSetIterator operator++(int) noexcept {
-            SparseSetIterator orig = *this;
-            return ++(*this), orig;
-        }
-
-        bool operator==(const SparseSetIterator &other) const noexcept {
-            return other.pos == pos && other.direct == direct;
-        }
-
-        bool operator!=(const SparseSetIterator &other) const noexcept {
-            return !(*this == other);
-        }
-
-        value_type operator*() const noexcept {
-            return (*direct)[pos-1];
-        }
-
-    private:
-        const std::vector<index_type> *direct;
-        size_type pos;
-    };
-
-    inline bool valid(Index idx) const noexcept {
-        return idx < reverse.size() && reverse[idx] < direct.size() && direct[reverse[idx]] == idx;
-    }
-
-public:
-    explicit SparseSet() = default;
-
-    SparseSet(const SparseSet &) = delete;
-    SparseSet(SparseSet &&) = default;
-
-    ~SparseSet() noexcept {
-        assert(empty());
-    }
-
-    SparseSet & operator=(const SparseSet &) = delete;
-    SparseSet & operator=(SparseSet &&) = default;
-
-    size_type size() const noexcept {
-        return direct.size();
-    }
-
-    size_t capacity() const noexcept {
-        return direct.capacity();
-    }
-
-    bool empty() const noexcept {
-        return direct.empty();
-    }
-
-    const index_type * data() const noexcept {
-        return direct.data();
-    }
-
-    iterator_type begin() const noexcept {
-        return SparseSetIterator{&direct, direct.size()};
-    }
-
-    iterator_type end() const noexcept {
-        return SparseSetIterator{&direct, 0};
-    }
-
-    bool has(index_type idx) const noexcept {
-        return valid(idx);
-    }
-
-    pos_type get(index_type idx) const noexcept {
-        assert(valid(idx));
-        return reverse[idx];
-    }
-
-    pos_type construct(index_type idx) {
-        assert(!valid(idx));
-
-        if(!(idx < reverse.size())) {
-            reverse.resize(idx+1);
-        }
-
-        auto pos = pos_type(direct.size());
-        reverse[idx] = pos;
-        direct.emplace_back(idx);
-
-        return pos;
-    }
-
-    pos_type destroy(index_type idx) {
-        assert(valid(idx));
-
-        auto last = direct.size() - 1;
-        auto pos = reverse[idx];
-
-        reverse[direct[last]] = pos;
-        direct[pos] = direct[last];
-        direct.pop_back();
-
-        return pos;
-    }
-
-    void swap(index_type lhs, index_type rhs) {
-        assert(valid(lhs));
-        assert(valid(rhs));
-
-        std::swap(direct[reverse[lhs]], direct[reverse[rhs]]);
-        std::swap(reverse[lhs], reverse[rhs]);
-    }
-
-    void reset() {
-        reverse.clear();
-        direct.clear();
-    }
-
-private:
-    std::vector<pos_type> reverse;
-    std::vector<index_type> direct;
-};
-
-
-template<typename Index, typename Type>
-class SparseSet<Index, Type> final: public SparseSet<Index> {
-    template<typename Compare>
-    void arrange(Compare compare) {
-        const auto *data = SparseSet<Index>::data();
-        const auto size = SparseSet<Index>::size();
-        std::vector<pos_type> copy(size);
-
-        std::iota(copy.begin(), copy.end(), pos_type{});
-        std::sort(copy.begin(), copy.end(), compare);
-
-        for(pos_type i = 0; i < copy.size(); ++i) {
-            const auto target = i;
-            auto curr = i;
-
-            while(copy[curr] != target) {
-                SparseSet<Index>::swap(*(data + copy[curr]), *(data + curr));
-                std::swap(instances[copy[curr]], instances[curr]);
-                std::swap(copy[curr], curr);
-            }
-
-            copy[curr] = curr;
-        }
-    }
-
-public:
-    using type = Type;
-    using index_type = typename SparseSet<Index>::index_type;
-    using pos_type = typename SparseSet<Index>::pos_type;
-    using size_type = typename SparseSet<Index>::size_type;
-    using iterator_type = typename SparseSet<Index>::iterator_type;
-
-    explicit SparseSet() = default;
-
-    SparseSet(const SparseSet &) = delete;
-    SparseSet(SparseSet &&) = default;
-
-    SparseSet & operator=(const SparseSet &) = delete;
-    SparseSet & operator=(SparseSet &&) = default;
-
-    type * raw() noexcept {
-        return instances.data();
-    }
-
-    const type * raw() const noexcept {
-        return instances.data();
-    }
-
-    const type & get(index_type idx) const noexcept {
-        return instances[SparseSet<Index>::get(idx)];
-    }
-
-    type & get(index_type idx) noexcept {
-        return const_cast<type &>(const_cast<const SparseSet *>(this)->get(idx));
-    }
-
-    template<typename... Args>
-    type & construct(index_type idx, Args&&... args) {
-        SparseSet<Index>::construct(idx);
-        instances.push_back({ std::forward<Args>(args)... });
-        return instances.back();
-    }
-
-    void destroy(index_type idx) {
-        auto pos = SparseSet<Index>::destroy(idx);
-        instances[pos] = std::move(instances[SparseSet<Index>::size()]);
-        instances.pop_back();
-    }
-
-    void swap(index_type lhs, index_type rhs) {
-        std::swap(instances[SparseSet<Index>::get(lhs)], instances[SparseSet<Index>::get(rhs)]);
-    }
-
-    template<typename Compare>
-    void sort(Compare compare) {
-        arrange([this, compare = std::move(compare)](auto lhs, auto rhs) {
-            return !compare(instances[lhs], instances[rhs]);
-        });
-    }
-
-    template<typename Idx>
-    void respect(const SparseSet<Idx> &other) {
-        const auto *data = SparseSet<Index>::data();
-
-        arrange([data, &other](auto lhs, auto rhs) {
-            auto eLhs = *(data + lhs);
-            auto eRhs = *(data + rhs);
-
-            bool bLhs = other.has(eLhs);
-            bool bRhs = other.has(eRhs);
-            bool compare = false;
-
-            if(bLhs && bRhs) {
-                compare = other.get(eLhs) < other.get(eRhs);
-            } else if(!bLhs && !bRhs) {
-                compare = eLhs < eRhs;
-            } else {
-                compare = bRhs;
-            }
-
-            return compare;
-        });
-    }
-
-    void reset() {
-        SparseSet<Index>::reset();
-        instances.clear();
-    }
-
-private:
-    std::vector<type> instances;
-};
-
-
-}
-
-
-#endif // ENTT_COMPONENT_POOL_HPP

+ 19 - 13
test/CMakeLists.txt

@@ -3,24 +3,30 @@
 #
 #
 
 
 set(COMMON_LINK_LIBS gtest_main Threads::Threads)
 set(COMMON_LINK_LIBS gtest_main Threads::Threads)
+include_directories(${PROJECT_SRC_DIR})
 
 
-# List of available targets
+# Test core
 
 
-set(TARGET_ENTT entt)
-set(TARGET_BENCHMARK benchmark)
+add_executable(core entt/core/ident.cpp entt/core/family.cpp odr.cpp)
+target_link_libraries(core PRIVATE ${COMMON_LINK_LIBS})
+add_test(NAME core COMMAND core)
 
 
-# Test TARGET_ENTT
+# Test entt
 
 
-add_executable(${TARGET_ENTT} ident.cpp registry.cpp sparse_set.cpp)
-target_include_directories(${TARGET_ENTT} PRIVATE ${PROJECT_SRC_DIR})
-target_link_libraries(${TARGET_ENTT} PRIVATE ${COMMON_LINK_LIBS})
-add_test(NAME ${TARGET_ENTT} COMMAND ${TARGET_ENTT})
+add_executable(entity entt/entity/registry.cpp entt/entity/sparse_set.cpp entt/entity/view.cpp odr.cpp)
+target_link_libraries(entity PRIVATE ${COMMON_LINK_LIBS})
+add_test(NAME entity COMMAND entity)
 
 
-# Test TARGET_BENCHMARK
+# Test benchmark
 
 
 IF(CMAKE_BUILD_TYPE MATCHES Release)
 IF(CMAKE_BUILD_TYPE MATCHES Release)
-    add_executable(${TARGET_BENCHMARK} benchmark.cpp)
-    target_include_directories(${TARGET_BENCHMARK} PRIVATE ${PROJECT_SRC_DIR})
-    target_link_libraries(${TARGET_BENCHMARK} PRIVATE ${COMMON_LINK_LIBS})
-    add_test(NAME ${TARGET_BENCHMARK} COMMAND ${TARGET_BENCHMARK})
+    add_executable(benchmark entt/entity/benchmark.cpp odr.cpp)
+    target_link_libraries(benchmark PRIVATE ${COMMON_LINK_LIBS})
+    add_test(NAME benchmark COMMAND benchmark)
 ENDIF()
 ENDIF()
+
+# Test signal
+
+add_executable(signal entt/signal/sigh.cpp odr.cpp)
+target_link_libraries(signal PRIVATE ${COMMON_LINK_LIBS})
+add_test(NAME signal COMMAND signal)

+ 0 - 459
test/benchmark.cpp

@@ -1,459 +0,0 @@
-#include <gtest/gtest.h>
-#include <registry.hpp>
-#include <iostream>
-#include <cstddef>
-#include <chrono>
-#include <vector>
-
-struct Position {
-    uint64_t x;
-    uint64_t y;
-};
-
-struct Velocity {
-    uint64_t x;
-    uint64_t y;
-};
-
-template<std::size_t>
-struct Comp {};
-
-struct Timer final {
-    Timer(): start{std::chrono::system_clock::now()} {}
-
-    void elapsed() {
-        auto now = std::chrono::system_clock::now();
-        std::cout << std::chrono::duration<double>(now - start).count() << " seconds" << std::endl;
-    }
-
-private:
-    std::chrono::time_point<std::chrono::system_clock> start;
-};
-
-TEST(DefaultRegistry, Construct) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Constructing 10000000 entities" << std::endl;
-
-    Timer timer;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        registry.create();
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, Destroy) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-    std::vector<registry_type::entity_type> entities{};
-
-    std::cout << "Destroying 10000000 entities" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        entities.push_back(registry.create());
-    }
-
-    Timer timer;
-
-    for (auto entity: entities) {
-        registry.destroy(entity);
-    }
-
-    timer.elapsed();
-}
-
-TEST(DefaultRegistry, IterateCreateDeleteSingleComponent) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Looping 10000 times creating and deleting a random number of entities" << std::endl;
-
-    Timer timer;
-
-    for(int i = 0; i < 10000; i++) {
-        for(int j = 0; j < 10000; j++) {
-            registry.create<Position>();
-        }
-
-        auto view = registry.view<Position>();
-
-        for(auto entity: view) {
-            if(rand() % 2 == 0) {
-                registry.destroy(entity);
-            }
-        }
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateSingleComponent10M) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, one component" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        registry.create<Position>();
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        (void)position;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateTwoComponents10M) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, two components" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        registry.create<Position, Velocity>();
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        (void)position;
-        (void)velocity;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateTwoComponents10MHalf) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, two components, half of the entities have all the components" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        auto entity = registry.create<Velocity>();
-        if(i % 2) { registry.assign<Position>(entity); }
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        (void)position;
-        (void)velocity;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateTwoComponents10MOne) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, two components, only one entity has all the components" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        auto entity = registry.create<Velocity>();
-        if(i == 5000000L) { registry.assign<Position>(entity); }
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        (void)position;
-        (void)velocity;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateSingleComponent50M) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 50000000 entities, one component" << std::endl;
-
-    for (uint64_t i = 0; i < 50000000L; i++) {
-        registry.create<Position>();
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        (void)position;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateTwoComponents50M) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 50000000 entities, two components" << std::endl;
-
-    for (uint64_t i = 0; i < 50000000L; i++) {
-        registry.create<Position, Velocity>();
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        (void)position;
-        (void)velocity;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateFiveComponents10M) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, five components" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        auto &comp1 = registry.get<Comp<1>>(entity);
-        auto &comp2 = registry.get<Comp<2>>(entity);
-        auto &comp3 = registry.get<Comp<3>>(entity);
-        (void)position;
-        (void)velocity;
-        (void)comp1;
-        (void)comp2;
-        (void)comp3;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateTenComponents10M) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, ten components" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        auto &comp1 = registry.get<Comp<1>>(entity);
-        auto &comp2 = registry.get<Comp<2>>(entity);
-        auto &comp3 = registry.get<Comp<3>>(entity);
-        auto &comp4 = registry.get<Comp<4>>(entity);
-        auto &comp5 = registry.get<Comp<5>>(entity);
-        auto &comp6 = registry.get<Comp<6>>(entity);
-        auto &comp7 = registry.get<Comp<7>>(entity);
-        auto &comp8 = registry.get<Comp<8>>(entity);
-        (void)position;
-        (void)velocity;
-        (void)comp1;
-        (void)comp2;
-        (void)comp3;
-        (void)comp4;
-        (void)comp5;
-        (void)comp6;
-        (void)comp7;
-        (void)comp8;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateTenComponents10MHalf) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, ten components, half of the entities have all the components" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
-        if(i % 2) { registry.assign<Position>(entity); }
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        auto &comp1 = registry.get<Comp<1>>(entity);
-        auto &comp2 = registry.get<Comp<2>>(entity);
-        auto &comp3 = registry.get<Comp<3>>(entity);
-        auto &comp4 = registry.get<Comp<4>>(entity);
-        auto &comp5 = registry.get<Comp<5>>(entity);
-        auto &comp6 = registry.get<Comp<6>>(entity);
-        auto &comp7 = registry.get<Comp<7>>(entity);
-        auto &comp8 = registry.get<Comp<8>>(entity);
-        (void)position;
-        (void)velocity;
-        (void)comp1;
-        (void)comp2;
-        (void)comp3;
-        (void)comp4;
-        (void)comp5;
-        (void)comp6;
-        (void)comp7;
-        (void)comp8;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, IterateTenComponents10MOne) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>;
-
-    registry_type registry;
-
-    std::cout << "Iterating over 10000000 entities, ten components, only one entity has all the components" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
-        if(i == 5000000L) { registry.assign<Position>(entity); }
-    }
-
-    Timer timer;
-
-    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
-
-    for(auto entity: view) {
-        auto &position = registry.get<Position>(entity);
-        auto &velocity = registry.get<Velocity>(entity);
-        auto &comp1 = registry.get<Comp<1>>(entity);
-        auto &comp2 = registry.get<Comp<2>>(entity);
-        auto &comp3 = registry.get<Comp<3>>(entity);
-        auto &comp4 = registry.get<Comp<4>>(entity);
-        auto &comp5 = registry.get<Comp<5>>(entity);
-        auto &comp6 = registry.get<Comp<6>>(entity);
-        auto &comp7 = registry.get<Comp<7>>(entity);
-        auto &comp8 = registry.get<Comp<8>>(entity);
-        (void)position;
-        (void)velocity;
-        (void)comp1;
-        (void)comp2;
-        (void)comp3;
-        (void)comp4;
-        (void)comp5;
-        (void)comp6;
-        (void)comp7;
-        (void)comp8;
-    }
-
-    timer.elapsed();
-    registry.reset();
-}
-
-TEST(DefaultRegistry, SortSingle) {
-    using registry_type = entt::DefaultRegistry<Position>;
-
-    registry_type registry;
-    std::vector<registry_type::entity_type> entities{};
-
-    std::cout << "Sort 10000000 entities" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        auto entity = registry.create();
-        entities.push_back(entity);
-        registry.assign<Position>(entity, i, i);
-    }
-
-    Timer timer;
-
-    registry.sort<Position>([](const auto &lhs, const auto &rhs) {
-        return lhs.x < rhs.x && lhs.y < rhs.y;
-    });
-
-    timer.elapsed();
-}
-
-TEST(DefaultRegistry, SortMulti) {
-    using registry_type = entt::DefaultRegistry<Position, Velocity>;
-
-    registry_type registry;
-    std::vector<registry_type::entity_type> entities{};
-
-    std::cout << "Sort 10000000 entities" << std::endl;
-
-    for (uint64_t i = 0; i < 10000000L; i++) {
-        auto entity = registry.create();
-        entities.push_back(entity);
-        registry.assign<Position>(entity, i, i);
-        registry.assign<Velocity>(entity, i, i);
-    }
-
-    registry.sort<Position>([](const auto &lhs, const auto &rhs) {
-        return lhs.x < rhs.x && lhs.y < rhs.y;
-    });
-
-    Timer timer;
-
-    registry.sort<Velocity, Position>();
-
-    timer.elapsed();
-}

+ 16 - 0
test/entt/core/family.cpp

@@ -0,0 +1,16 @@
+#include <gtest/gtest.h>
+#include <entt/core/family.hpp>
+
+using my_family = entt::Family<struct MyFamily>;
+using your_family = entt::Family<struct YourFamily>;
+
+TEST(Family, Functionalities) {
+    auto myFamilyType = my_family::type<struct MyFamilyType>();
+    auto mySameFamilyType = my_family::type<struct MyFamilyType>();
+    auto myOtherFamilyType = my_family::type<struct MyOtherFamilyType>();
+    auto yourFamilyType = your_family::type<struct YourFamilyType>();
+
+    ASSERT_EQ(myFamilyType, mySameFamilyType);
+    ASSERT_NE(myFamilyType, myOtherFamilyType);
+    ASSERT_EQ(myFamilyType, yourFamilyType);
+}

+ 1 - 1
test/ident.cpp → test/entt/core/ident.cpp

@@ -1,5 +1,5 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
-#include <ident.hpp>
+#include <entt/core/ident.hpp>
 
 
 struct A {};
 struct A {};
 struct B {};
 struct B {};

+ 687 - 0
test/entt/entity/benchmark.cpp

@@ -0,0 +1,687 @@
+#include <gtest/gtest.h>
+#include <iostream>
+#include <cstddef>
+#include <chrono>
+#include <vector>
+#include <entt/entity/registry.hpp>
+
+struct Position {
+    uint64_t x;
+    uint64_t y;
+};
+
+struct Velocity {
+    uint64_t x;
+    uint64_t y;
+};
+
+template<std::size_t>
+struct Comp {};
+
+struct Timer final {
+    Timer(): start{std::chrono::system_clock::now()} {}
+
+    void elapsed() {
+        auto now = std::chrono::system_clock::now();
+        std::cout << std::chrono::duration<double>(now - start).count() << " seconds" << std::endl;
+    }
+
+private:
+    std::chrono::time_point<std::chrono::system_clock> start;
+};
+
+TEST(DefaultRegistry, Construct) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Constructing 10000000 entities" << std::endl;
+
+    Timer timer;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create();
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, Destroy) {
+    entt::DefaultRegistry registry;
+    std::vector<entt::DefaultRegistry::entity_type> entities{};
+
+    std::cout << "Destroying 10000000 entities" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        entities.push_back(registry.create());
+    }
+
+    Timer timer;
+
+    for (auto entity: entities) {
+        registry.destroy(entity);
+    }
+
+    timer.elapsed();
+}
+
+TEST(DefaultRegistry, IterateCreateDeleteSingleComponent) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Looping 10000 times creating and deleting a random number of entities" << std::endl;
+
+    Timer timer;
+
+    auto view = registry.view<Position>();
+
+    for(int i = 0; i < 10000; i++) {
+        for(int j = 0; j < 10000; j++) {
+            registry.create<Position>();
+        }
+
+        for(auto entity: view) {
+            if(rand() % 2 == 0) {
+                registry.destroy(entity);
+            }
+        }
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateSingleComponent10M) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, one component" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create<Position>();
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position>();
+
+    for(auto entity: view) {
+        auto &position = view.get(entity);
+        (void)position;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponents10M) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, two components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create<Position, Velocity>();
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponents10MHalf) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, two components, half of the entities have all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity>();
+        if(i % 2) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponents10MOne) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, two components, only one entity has all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity>();
+        if(i == 5000000L) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponentsPersistent10M) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity>();
+
+    std::cout << "Iterating over 10000000 entities, two components, persistent view" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create<Position, Velocity>();
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponentsPersistent10MHalf) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity>();
+
+    std::cout << "Iterating over 10000000 entities, two components, persistent view, half of the entities have all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity>();
+        if(i % 2) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponentsPersistent10MOne) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity>();
+
+    std::cout << "Iterating over 10000000 entities, two components, persistent view, only one entity has all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity>();
+        if(i == 5000000L) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateSingleComponent50M) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 50000000 entities, one component" << std::endl;
+
+    for (uint64_t i = 0; i < 50000000L; i++) {
+        registry.create<Position>();
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position>();
+
+    for(auto entity: view) {
+        auto &position = view.get(entity);
+        (void)position;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponents50M) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 50000000 entities, two components" << std::endl;
+
+    for (uint64_t i = 0; i < 50000000L; i++) {
+        registry.create<Position, Velocity>();
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTwoComponentsPersistent50M) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity>();
+
+    std::cout << "Iterating over 50000000 entities, two components, persistent view" << std::endl;
+
+    for (uint64_t i = 0; i < 50000000L; i++) {
+        registry.create<Position, Velocity>();
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        (void)position;
+        (void)velocity;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateFiveComponents10M) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, five components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTenComponents10M) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, ten components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        auto &comp4 = view.get<Comp<4>>(entity);
+        auto &comp5 = view.get<Comp<5>>(entity);
+        auto &comp6 = view.get<Comp<6>>(entity);
+        auto &comp7 = view.get<Comp<7>>(entity);
+        auto &comp8 = view.get<Comp<8>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+        (void)comp4;
+        (void)comp5;
+        (void)comp6;
+        (void)comp7;
+        (void)comp8;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTenComponents10MHalf) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, ten components, half of the entities have all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+        if(i % 2) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        auto &comp4 = view.get<Comp<4>>(entity);
+        auto &comp5 = view.get<Comp<5>>(entity);
+        auto &comp6 = view.get<Comp<6>>(entity);
+        auto &comp7 = view.get<Comp<7>>(entity);
+        auto &comp8 = view.get<Comp<8>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+        (void)comp4;
+        (void)comp5;
+        (void)comp6;
+        (void)comp7;
+        (void)comp8;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTenComponents10MOne) {
+    entt::DefaultRegistry registry;
+
+    std::cout << "Iterating over 10000000 entities, ten components, only one entity has all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+        if(i == 5000000L) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        auto &comp4 = view.get<Comp<4>>(entity);
+        auto &comp5 = view.get<Comp<5>>(entity);
+        auto &comp6 = view.get<Comp<6>>(entity);
+        auto &comp7 = view.get<Comp<7>>(entity);
+        auto &comp8 = view.get<Comp<8>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+        (void)comp4;
+        (void)comp5;
+        (void)comp6;
+        (void)comp7;
+        (void)comp8;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateFiveComponentsPersistent10M) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
+
+    std::cout << "Iterating over 10000000 entities, five components, persistent view" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTenComponentsPersistent10M) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    std::cout << "Iterating over 10000000 entities, ten components, persistent view" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        auto &comp4 = view.get<Comp<4>>(entity);
+        auto &comp5 = view.get<Comp<5>>(entity);
+        auto &comp6 = view.get<Comp<6>>(entity);
+        auto &comp7 = view.get<Comp<7>>(entity);
+        auto &comp8 = view.get<Comp<8>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+        (void)comp4;
+        (void)comp5;
+        (void)comp6;
+        (void)comp7;
+        (void)comp8;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTenComponentsPersistent10MHalf) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    std::cout << "Iterating over 10000000 entities, ten components, persistent view, half of the entities have all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+        if(i % 2) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        auto &comp4 = view.get<Comp<4>>(entity);
+        auto &comp5 = view.get<Comp<5>>(entity);
+        auto &comp6 = view.get<Comp<6>>(entity);
+        auto &comp7 = view.get<Comp<7>>(entity);
+        auto &comp8 = view.get<Comp<8>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+        (void)comp4;
+        (void)comp5;
+        (void)comp6;
+        (void)comp7;
+        (void)comp8;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, IterateTenComponentsPersistent10MOne) {
+    entt::DefaultRegistry registry;
+    registry.prepare<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    std::cout << "Iterating over 10000000 entities, ten components, persistent view, only one entity has all the components" << std::endl;
+
+    for (uint64_t i = 0; i < 10000000L; i++) {
+        auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+        if(i == 5000000L) { registry.assign<Position>(entity); }
+    }
+
+    Timer timer;
+
+    auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
+
+    for(auto entity: view) {
+        auto &position = view.get<Position>(entity);
+        auto &velocity = view.get<Velocity>(entity);
+        auto &comp1 = view.get<Comp<1>>(entity);
+        auto &comp2 = view.get<Comp<2>>(entity);
+        auto &comp3 = view.get<Comp<3>>(entity);
+        auto &comp4 = view.get<Comp<4>>(entity);
+        auto &comp5 = view.get<Comp<5>>(entity);
+        auto &comp6 = view.get<Comp<6>>(entity);
+        auto &comp7 = view.get<Comp<7>>(entity);
+        auto &comp8 = view.get<Comp<8>>(entity);
+        (void)position;
+        (void)velocity;
+        (void)comp1;
+        (void)comp2;
+        (void)comp3;
+        (void)comp4;
+        (void)comp5;
+        (void)comp6;
+        (void)comp7;
+        (void)comp8;
+    }
+
+    timer.elapsed();
+    registry.reset();
+}
+
+TEST(DefaultRegistry, SortSingle) {
+    entt::DefaultRegistry registry;
+    std::vector<entt::DefaultRegistry::entity_type> entities{};
+
+    std::cout << "Sort 150000 entities, one component" << std::endl;
+
+    for (uint64_t i = 0; i < 150000L; i++) {
+        auto entity = registry.create();
+        entities.push_back(entity);
+        registry.assign<Position>(entity, i, i);
+    }
+
+    Timer timer;
+
+    registry.sort<Position>([&registry](const auto &lhs, const auto &rhs) {
+        return lhs.x < rhs.x && lhs.y < rhs.y;
+    });
+
+    timer.elapsed();
+}
+
+TEST(DefaultRegistry, SortMulti) {
+    entt::DefaultRegistry registry;
+    std::vector<entt::DefaultRegistry::entity_type> entities{};
+
+    std::cout << "Sort 150000 entities, two components" << std::endl;
+
+    for (uint64_t i = 0; i < 150000L; i++) {
+        auto entity = registry.create();
+        entities.push_back(entity);
+        registry.assign<Position>(entity, i, i);
+        registry.assign<Velocity>(entity, i, i);
+    }
+
+    registry.sort<Position>([&registry](const auto &lhs, const auto &rhs) {
+        return lhs.x < rhs.x && lhs.y < rhs.y;
+    });
+
+    Timer timer;
+
+    registry.sort<Velocity, Position>();
+
+    timer.elapsed();
+}

+ 184 - 0
test/entt/entity/registry.cpp

@@ -0,0 +1,184 @@
+#include <functional>
+#include <gtest/gtest.h>
+#include <entt/entity/registry.hpp>
+
+TEST(DefaultRegistry, Functionalities) {
+    entt::DefaultRegistry registry;
+
+    ASSERT_EQ(registry.size(), entt::DefaultRegistry::size_type{0});
+    ASSERT_TRUE(registry.empty());
+
+    ASSERT_EQ(registry.capacity(), entt::DefaultRegistry::size_type{0});
+    ASSERT_EQ(registry.size<int>(), entt::DefaultRegistry::size_type{0});
+    ASSERT_EQ(registry.size<char>(), entt::DefaultRegistry::size_type{0});
+    ASSERT_TRUE(registry.empty<int>());
+    ASSERT_TRUE(registry.empty<char>());
+
+    auto e1 = registry.create();
+    auto e2 = registry.create<int, char>();
+
+    ASSERT_EQ(registry.capacity(), entt::DefaultRegistry::size_type{2});
+    ASSERT_EQ(registry.size<int>(), entt::DefaultRegistry::size_type{1});
+    ASSERT_EQ(registry.size<char>(), entt::DefaultRegistry::size_type{1});
+    ASSERT_FALSE(registry.empty<int>());
+    ASSERT_FALSE(registry.empty<char>());
+
+    ASSERT_NE(e1, e2);
+
+    ASSERT_FALSE(registry.has<int>(e1));
+    ASSERT_TRUE(registry.has<int>(e2));
+    ASSERT_FALSE(registry.has<char>(e1));
+    ASSERT_TRUE(registry.has<char>(e2));
+    ASSERT_FALSE((registry.has<int, char>(e1)));
+    ASSERT_TRUE((registry.has<int, char>(e2)));
+
+    ASSERT_EQ(registry.assign<int>(e1, 42), 42);
+    ASSERT_EQ(registry.assign<char>(e1, 'c'), 'c');
+    ASSERT_NO_THROW(registry.remove<int>(e2));
+    ASSERT_NO_THROW(registry.remove<char>(e2));
+
+    ASSERT_TRUE(registry.has<int>(e1));
+    ASSERT_FALSE(registry.has<int>(e2));
+    ASSERT_TRUE(registry.has<char>(e1));
+    ASSERT_FALSE(registry.has<char>(e2));
+    ASSERT_TRUE((registry.has<int, char>(e1)));
+    ASSERT_FALSE((registry.has<int, char>(e2)));
+
+    auto e3 = registry.create();
+
+    registry.accomodate<int>(e3, registry.get<int>(e1));
+    registry.accomodate<char>(e3, registry.get<char>(e1));
+
+    ASSERT_TRUE(registry.has<int>(e3));
+    ASSERT_TRUE(registry.has<char>(e3));
+    ASSERT_EQ(registry.get<int>(e1), 42);
+    ASSERT_EQ(registry.get<char>(e1), 'c');
+    ASSERT_EQ(registry.get<int>(e1), registry.get<int>(e3));
+    ASSERT_EQ(registry.get<char>(e1), registry.get<char>(e3));
+    ASSERT_NE(&registry.get<int>(e1), &registry.get<int>(e3));
+    ASSERT_NE(&registry.get<char>(e1), &registry.get<char>(e3));
+
+    ASSERT_NO_THROW(registry.replace<int>(e1, 0));
+    ASSERT_EQ(registry.get<int>(e1), 0);
+
+    ASSERT_NO_THROW(registry.accomodate<int>(e1, 1));
+    ASSERT_NO_THROW(registry.accomodate<int>(e2, 1));
+    ASSERT_EQ(static_cast<const entt::DefaultRegistry &>(registry).get<int>(e1), 1);
+    ASSERT_EQ(static_cast<const entt::DefaultRegistry &>(registry).get<int>(e2), 1);
+
+    ASSERT_EQ(registry.size(), entt::DefaultRegistry::size_type{3});
+    ASSERT_FALSE(registry.empty());
+
+    ASSERT_EQ(registry.version(e3), entt::DefaultRegistry::version_type{0});
+    ASSERT_EQ(registry.current(e3), entt::DefaultRegistry::version_type{0});
+    ASSERT_EQ(registry.capacity(), entt::DefaultRegistry::size_type{3});
+    ASSERT_NO_THROW(registry.destroy(e3));
+    ASSERT_EQ(registry.capacity(), entt::DefaultRegistry::size_type{3});
+    ASSERT_EQ(registry.version(e3), entt::DefaultRegistry::version_type{0});
+    ASSERT_EQ(registry.current(e3), entt::DefaultRegistry::version_type{1});
+
+    ASSERT_TRUE(registry.valid(e1));
+    ASSERT_TRUE(registry.valid(e2));
+    ASSERT_FALSE(registry.valid(e3));
+
+    ASSERT_EQ(registry.size(), entt::DefaultRegistry::size_type{2});
+    ASSERT_FALSE(registry.empty());
+
+    ASSERT_NO_THROW(registry.reset());
+
+    ASSERT_EQ(registry.size(), entt::DefaultRegistry::size_type{0});
+    ASSERT_TRUE(registry.empty());
+
+    registry.create<int, char>();
+
+    ASSERT_EQ(registry.size<int>(), entt::DefaultRegistry::size_type{1});
+    ASSERT_EQ(registry.size<char>(), entt::DefaultRegistry::size_type{1});
+    ASSERT_FALSE(registry.empty<int>());
+    ASSERT_FALSE(registry.empty<char>());
+
+    ASSERT_NO_THROW(registry.reset<int>());
+
+    ASSERT_EQ(registry.size<int>(), entt::DefaultRegistry::size_type{0});
+    ASSERT_EQ(registry.size<char>(), entt::DefaultRegistry::size_type{1});
+    ASSERT_TRUE(registry.empty<int>());
+    ASSERT_FALSE(registry.empty<char>());
+
+    ASSERT_NO_THROW(registry.reset());
+
+    ASSERT_EQ(registry.size<int>(), entt::DefaultRegistry::size_type{0});
+    ASSERT_EQ(registry.size<char>(), entt::DefaultRegistry::size_type{0});
+    ASSERT_TRUE(registry.empty<int>());
+    ASSERT_TRUE(registry.empty<char>());
+
+    e1 = registry.create<int>();
+    e2 = registry.create();
+
+    ASSERT_NO_THROW(registry.reset<int>(e1));
+    ASSERT_NO_THROW(registry.reset<int>(e2));
+
+    ASSERT_EQ(registry.size<int>(), entt::DefaultRegistry::size_type{0});
+    ASSERT_EQ(registry.size<char>(), entt::DefaultRegistry::size_type{0});
+    ASSERT_TRUE(registry.empty<int>());
+}
+
+TEST(DefaultRegistry, SortSingle) {
+    entt::DefaultRegistry registry;
+
+    auto e1 = registry.create();
+    auto e2 = registry.create();
+    auto e3 = registry.create();
+
+    auto val = 0;
+
+    registry.assign<int>(e1, val++);
+    registry.assign<int>(e2, val++);
+    registry.assign<int>(e3, val++);
+
+    for(auto entity: registry.view<int>()) {
+        ASSERT_EQ(registry.get<int>(entity), --val);
+    }
+
+    registry.sort<int>(std::less<int>{});
+
+    for(auto entity: registry.view<int>()) {
+        ASSERT_EQ(registry.get<int>(entity), val++);
+    }
+}
+
+TEST(DefaultRegistry, SortMulti) {
+    entt::DefaultRegistry registry;
+
+    auto e1 = registry.create();
+    auto e2 = registry.create();
+    auto e3 = registry.create();
+
+    auto uval = 0u;
+    auto ival = 0;
+
+    registry.assign<unsigned int>(e1, uval++);
+    registry.assign<unsigned int>(e2, uval++);
+    registry.assign<unsigned int>(e3, uval++);
+
+    registry.assign<int>(e1, ival++);
+    registry.assign<int>(e2, ival++);
+    registry.assign<int>(e3, ival++);
+
+    for(auto entity: registry.view<unsigned int>()) {
+        ASSERT_EQ(registry.get<unsigned int>(entity), --uval);
+    }
+
+    for(auto entity: registry.view<int>()) {
+        ASSERT_EQ(registry.get<int>(entity), --ival);
+    }
+
+    registry.sort<unsigned int>(std::less<unsigned int>{});
+    registry.sort<int, unsigned int>();
+
+    for(auto entity: registry.view<unsigned int>()) {
+        ASSERT_EQ(registry.get<unsigned int>(entity), uval++);
+    }
+
+    for(auto entity: registry.view<int>()) {
+        ASSERT_EQ(registry.get<int>(entity), ival++);
+    }
+}

+ 77 - 105
test/sparse_set.cpp → test/entt/entity/sparse_set.cpp

@@ -1,14 +1,11 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
-#include <sparse_set.hpp>
+#include <entt/entity/sparse_set.hpp>
 
 
 TEST(SparseSetNoType, Functionalities) {
 TEST(SparseSetNoType, Functionalities) {
-    using SparseSet = entt::SparseSet<unsigned int>;
-
-    SparseSet set;
+    entt::SparseSet<unsigned int> set;
 
 
     ASSERT_TRUE(set.empty());
     ASSERT_TRUE(set.empty());
     ASSERT_EQ(set.size(), 0u);
     ASSERT_EQ(set.size(), 0u);
-    ASSERT_EQ(set.capacity(), 0u);
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(42));
     ASSERT_FALSE(set.has(42));
@@ -17,17 +14,15 @@ TEST(SparseSetNoType, Functionalities) {
 
 
     ASSERT_FALSE(set.empty());
     ASSERT_FALSE(set.empty());
     ASSERT_EQ(set.size(), 1u);
     ASSERT_EQ(set.size(), 1u);
-    ASSERT_GE(set.capacity(), 1u);
     ASSERT_NE(set.begin(), set.end());
     ASSERT_NE(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_TRUE(set.has(42));
     ASSERT_TRUE(set.has(42));
     ASSERT_EQ(set.get(42), 0u);
     ASSERT_EQ(set.get(42), 0u);
 
 
-    ASSERT_EQ(set.destroy(42), 0u);
+    set.destroy(42);
 
 
     ASSERT_TRUE(set.empty());
     ASSERT_TRUE(set.empty());
     ASSERT_EQ(set.size(), 0u);
     ASSERT_EQ(set.size(), 0u);
-    ASSERT_GE(set.capacity(), 1u);
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(42));
     ASSERT_FALSE(set.has(42));
@@ -38,16 +33,17 @@ TEST(SparseSetNoType, Functionalities) {
 
 
     ASSERT_TRUE(set.empty());
     ASSERT_TRUE(set.empty());
     ASSERT_EQ(set.size(), 0u);
     ASSERT_EQ(set.size(), 0u);
-    ASSERT_GE(set.capacity(), 0u);
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(42));
     ASSERT_FALSE(set.has(42));
+
+    (void)entt::SparseSet<unsigned int>{std::move(set)};
+    entt::SparseSet<unsigned int> other;
+    other = std::move(set);
 }
 }
 
 
 TEST(SparseSetNoType, DataBeginEnd) {
 TEST(SparseSetNoType, DataBeginEnd) {
-    using SparseSet = entt::SparseSet<unsigned int>;
-
-    SparseSet set;
+    entt::SparseSet<unsigned int> set;
 
 
     ASSERT_EQ(set.construct(3), 0u);
     ASSERT_EQ(set.construct(3), 0u);
     ASSERT_EQ(set.construct(12), 1u);
     ASSERT_EQ(set.construct(12), 1u);
@@ -64,37 +60,13 @@ TEST(SparseSetNoType, DataBeginEnd) {
     ASSERT_EQ(*(begin++), 12u);
     ASSERT_EQ(*(begin++), 12u);
     ASSERT_EQ(*(begin++), 3u);
     ASSERT_EQ(*(begin++), 3u);
     ASSERT_EQ(begin, end);
     ASSERT_EQ(begin, end);
-
-    set.reset();
-}
-
-TEST(SparseSetNoType, Swap) {
-    using SparseSet = entt::SparseSet<unsigned int>;
-
-    SparseSet set;
-
-    ASSERT_EQ(set.construct(3), 0u);
-    ASSERT_EQ(set.construct(12), 1u);
-
-    ASSERT_EQ(*(set.data() + 0u), 3u);
-    ASSERT_EQ(*(set.data() + 1u), 12u);
-
-    set.swap(3, 12);
-
-    ASSERT_EQ(*(set.data() + 0u), 12u);
-    ASSERT_EQ(*(set.data() + 1u), 3u);
-
-    set.reset();
 }
 }
 
 
 TEST(SparseSetWithType, Functionalities) {
 TEST(SparseSetWithType, Functionalities) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet set;
+    entt::SparseSet<unsigned int, int> set;
 
 
     ASSERT_TRUE(set.empty());
     ASSERT_TRUE(set.empty());
     ASSERT_EQ(set.size(), 0u);
     ASSERT_EQ(set.size(), 0u);
-    ASSERT_EQ(set.capacity(), 0u);
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(42));
     ASSERT_FALSE(set.has(42));
@@ -103,7 +75,6 @@ TEST(SparseSetWithType, Functionalities) {
 
 
     ASSERT_FALSE(set.empty());
     ASSERT_FALSE(set.empty());
     ASSERT_EQ(set.size(), 1u);
     ASSERT_EQ(set.size(), 1u);
-    ASSERT_GE(set.capacity(), 1u);
     ASSERT_NE(set.begin(), set.end());
     ASSERT_NE(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_TRUE(set.has(42));
     ASSERT_TRUE(set.has(42));
@@ -113,7 +84,6 @@ TEST(SparseSetWithType, Functionalities) {
 
 
     ASSERT_TRUE(set.empty());
     ASSERT_TRUE(set.empty());
     ASSERT_EQ(set.size(), 0u);
     ASSERT_EQ(set.size(), 0u);
-    ASSERT_GE(set.capacity(), 1u);
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(42));
     ASSERT_FALSE(set.has(42));
@@ -124,16 +94,17 @@ TEST(SparseSetWithType, Functionalities) {
 
 
     ASSERT_TRUE(set.empty());
     ASSERT_TRUE(set.empty());
     ASSERT_EQ(set.size(), 0u);
     ASSERT_EQ(set.size(), 0u);
-    ASSERT_GE(set.capacity(), 0u);
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_EQ(set.begin(), set.end());
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(0));
     ASSERT_FALSE(set.has(42));
     ASSERT_FALSE(set.has(42));
+
+    (void)entt::SparseSet<unsigned int>{std::move(set)};
+    entt::SparseSet<unsigned int> other;
+    other = std::move(set);
 }
 }
 
 
 TEST(SparseSetWithType, RawBeginEnd) {
 TEST(SparseSetWithType, RawBeginEnd) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet set;
+    entt::SparseSet<unsigned int, int> set;
 
 
     ASSERT_EQ(set.construct(3, 3), 3);
     ASSERT_EQ(set.construct(3, 3), 3);
     ASSERT_EQ(set.construct(12, 6), 6);
     ASSERT_EQ(set.construct(12, 6), 6);
@@ -150,33 +121,10 @@ TEST(SparseSetWithType, RawBeginEnd) {
     ASSERT_EQ(set.get(*(begin++)), 6);
     ASSERT_EQ(set.get(*(begin++)), 6);
     ASSERT_EQ(set.get(*(begin++)), 3);
     ASSERT_EQ(set.get(*(begin++)), 3);
     ASSERT_EQ(begin, end);
     ASSERT_EQ(begin, end);
-
-    set.reset();
-}
-
-TEST(SparseSetWithType, Swap) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet set;
-
-    ASSERT_EQ(set.construct(3, 3), 3);
-    ASSERT_EQ(set.construct(12, 6), 6);
-
-    ASSERT_EQ(*(set.raw() + 0u), 3);
-    ASSERT_EQ(*(set.raw() + 1u), 6);
-
-    set.swap(3, 12);
-
-    ASSERT_EQ(*(set.raw() + 0u), 6);
-    ASSERT_EQ(*(set.raw() + 1u), 3);
-
-    set.reset();
 }
 }
 
 
 TEST(SparseSetWithType, SortOrdered) {
 TEST(SparseSetWithType, SortOrdered) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet set;
+    entt::SparseSet<unsigned int, int> set;
 
 
     ASSERT_EQ(set.construct(12, 12), 12);
     ASSERT_EQ(set.construct(12, 12), 12);
     ASSERT_EQ(set.construct(42, 9), 9);
     ASSERT_EQ(set.construct(42, 9), 9);
@@ -184,8 +132,8 @@ TEST(SparseSetWithType, SortOrdered) {
     ASSERT_EQ(set.construct(3, 3), 3);
     ASSERT_EQ(set.construct(3, 3), 3);
     ASSERT_EQ(set.construct(9, 1), 1);
     ASSERT_EQ(set.construct(9, 1), 1);
 
 
-    set.sort([](auto lhs, auto rhs) {
-        return lhs < rhs;
+    set.sort([&set](auto lhs, auto rhs) {
+        return set.get(lhs) < set.get(rhs);
     });
     });
 
 
     ASSERT_EQ(*(set.raw() + 0u), 12);
     ASSERT_EQ(*(set.raw() + 0u), 12);
@@ -203,14 +151,10 @@ TEST(SparseSetWithType, SortOrdered) {
     ASSERT_EQ(set.get(*(begin++)), 9);
     ASSERT_EQ(set.get(*(begin++)), 9);
     ASSERT_EQ(set.get(*(begin++)), 12);
     ASSERT_EQ(set.get(*(begin++)), 12);
     ASSERT_EQ(begin, end);
     ASSERT_EQ(begin, end);
-
-    set.reset();
 }
 }
 
 
 TEST(SparseSetWithType, SortReverse) {
 TEST(SparseSetWithType, SortReverse) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet set;
+    entt::SparseSet<unsigned int, int> set;
 
 
     ASSERT_EQ(set.construct(12, 1), 1);
     ASSERT_EQ(set.construct(12, 1), 1);
     ASSERT_EQ(set.construct(42, 3), 3);
     ASSERT_EQ(set.construct(42, 3), 3);
@@ -218,8 +162,8 @@ TEST(SparseSetWithType, SortReverse) {
     ASSERT_EQ(set.construct(3, 9), 9);
     ASSERT_EQ(set.construct(3, 9), 9);
     ASSERT_EQ(set.construct(9, 12), 12);
     ASSERT_EQ(set.construct(9, 12), 12);
 
 
-    set.sort([](auto lhs, auto rhs) {
-        return lhs < rhs;
+    set.sort([&set](auto lhs, auto rhs) {
+        return set.get(lhs) < set.get(rhs);
     });
     });
 
 
     ASSERT_EQ(*(set.raw() + 0u), 12);
     ASSERT_EQ(*(set.raw() + 0u), 12);
@@ -237,14 +181,10 @@ TEST(SparseSetWithType, SortReverse) {
     ASSERT_EQ(set.get(*(begin++)), 9);
     ASSERT_EQ(set.get(*(begin++)), 9);
     ASSERT_EQ(set.get(*(begin++)), 12);
     ASSERT_EQ(set.get(*(begin++)), 12);
     ASSERT_EQ(begin, end);
     ASSERT_EQ(begin, end);
-
-    set.reset();
 }
 }
 
 
 TEST(SparseSetWithType, SortUnordered) {
 TEST(SparseSetWithType, SortUnordered) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet set;
+    entt::SparseSet<unsigned int, int> set;
 
 
     ASSERT_EQ(set.construct(12, 6), 6);
     ASSERT_EQ(set.construct(12, 6), 6);
     ASSERT_EQ(set.construct(42, 3), 3);
     ASSERT_EQ(set.construct(42, 3), 3);
@@ -252,8 +192,8 @@ TEST(SparseSetWithType, SortUnordered) {
     ASSERT_EQ(set.construct(3, 9), 9);
     ASSERT_EQ(set.construct(3, 9), 9);
     ASSERT_EQ(set.construct(9, 12), 12);
     ASSERT_EQ(set.construct(9, 12), 12);
 
 
-    set.sort([](auto lhs, auto rhs) {
-        return lhs < rhs;
+    set.sort([&set](auto lhs, auto rhs) {
+        return set.get(lhs) < set.get(rhs);
     });
     });
 
 
     ASSERT_EQ(*(set.raw() + 0u), 12);
     ASSERT_EQ(*(set.raw() + 0u), 12);
@@ -271,15 +211,60 @@ TEST(SparseSetWithType, SortUnordered) {
     ASSERT_EQ(set.get(*(begin++)), 9);
     ASSERT_EQ(set.get(*(begin++)), 9);
     ASSERT_EQ(set.get(*(begin++)), 12);
     ASSERT_EQ(set.get(*(begin++)), 12);
     ASSERT_EQ(begin, end);
     ASSERT_EQ(begin, end);
+}
 
 
-    set.reset();
+TEST(SparseSetWithType, RespectDisjoint) {
+    entt::SparseSet<unsigned int, int> lhs;
+    entt::SparseSet<unsigned int, int> rhs;
+    const auto &clhs = lhs;
+
+    ASSERT_EQ(lhs.construct(3, 3), 3);
+    ASSERT_EQ(lhs.construct(12, 6), 6);
+    ASSERT_EQ(lhs.construct(42, 9), 9);
+
+    lhs.respect(rhs);
+
+    ASSERT_EQ(*(clhs.raw() + 0u), 3);
+    ASSERT_EQ(*(clhs.raw() + 1u), 6);
+    ASSERT_EQ(*(clhs.raw() + 2u), 9);
+
+    auto begin = clhs.begin();
+    auto end = clhs.end();
+
+    ASSERT_EQ(clhs.get(*(begin++)), 9);
+    ASSERT_EQ(clhs.get(*(begin++)), 6);
+    ASSERT_EQ(clhs.get(*(begin++)), 3);
+    ASSERT_EQ(begin, end);
 }
 }
 
 
-TEST(SparseSetWithType, RespectOrdered) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
+TEST(SparseSetWithType, RespectOverlap) {
+    entt::SparseSet<unsigned int, int> lhs;
+    entt::SparseSet<unsigned int, int> rhs;
+    const auto &clhs = lhs;
+
+    ASSERT_EQ(lhs.construct(3, 3), 3);
+    ASSERT_EQ(lhs.construct(12, 6), 6);
+    ASSERT_EQ(lhs.construct(42, 9), 9);
+    ASSERT_EQ(rhs.construct(12, 6), 6);
+
+    lhs.respect(rhs);
+
+    ASSERT_EQ(*(clhs.raw() + 0u), 3);
+    ASSERT_EQ(*(clhs.raw() + 1u), 9);
+    ASSERT_EQ(*(clhs.raw() + 2u), 6);
+
+    auto begin = clhs.begin();
+    auto end = clhs.end();
+
+    ASSERT_EQ(clhs.get(*(begin++)), 6);
+    ASSERT_EQ(clhs.get(*(begin++)), 9);
+    ASSERT_EQ(clhs.get(*(begin++)), 3);
+    ASSERT_EQ(begin, end);
+}
 
 
-    SparseSet lhs;
-    SparseSet rhs;
+TEST(SparseSetWithType, RespectOrdered) {
+    entt::SparseSet<unsigned int, int> lhs;
+    entt::SparseSet<unsigned int, int> rhs;
 
 
     ASSERT_EQ(lhs.construct(1, 0), 0);
     ASSERT_EQ(lhs.construct(1, 0), 0);
     ASSERT_EQ(lhs.construct(2, 0), 0);
     ASSERT_EQ(lhs.construct(2, 0), 0);
@@ -308,16 +293,11 @@ TEST(SparseSetWithType, RespectOrdered) {
     ASSERT_EQ(*(rhs.data() + 3u), 3u);
     ASSERT_EQ(*(rhs.data() + 3u), 3u);
     ASSERT_EQ(*(rhs.data() + 4u), 4u);
     ASSERT_EQ(*(rhs.data() + 4u), 4u);
     ASSERT_EQ(*(rhs.data() + 5u), 5u);
     ASSERT_EQ(*(rhs.data() + 5u), 5u);
-
-    lhs.reset();
-    rhs.reset();
 }
 }
 
 
 TEST(SparseSetWithType, RespectReverse) {
 TEST(SparseSetWithType, RespectReverse) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet lhs;
-    SparseSet rhs;
+    entt::SparseSet<unsigned int, int> lhs;
+    entt::SparseSet<unsigned int, int> rhs;
 
 
     ASSERT_EQ(lhs.construct(1, 0), 0);
     ASSERT_EQ(lhs.construct(1, 0), 0);
     ASSERT_EQ(lhs.construct(2, 0), 0);
     ASSERT_EQ(lhs.construct(2, 0), 0);
@@ -346,16 +326,11 @@ TEST(SparseSetWithType, RespectReverse) {
     ASSERT_EQ(*(rhs.data() + 3u), 3u);
     ASSERT_EQ(*(rhs.data() + 3u), 3u);
     ASSERT_EQ(*(rhs.data() + 4u), 4u);
     ASSERT_EQ(*(rhs.data() + 4u), 4u);
     ASSERT_EQ(*(rhs.data() + 5u), 5u);
     ASSERT_EQ(*(rhs.data() + 5u), 5u);
-
-    lhs.reset();
-    rhs.reset();
 }
 }
 
 
 TEST(SparseSetWithType, RespectUnordered) {
 TEST(SparseSetWithType, RespectUnordered) {
-    using SparseSet = entt::SparseSet<unsigned int, int>;
-
-    SparseSet lhs;
-    SparseSet rhs;
+    entt::SparseSet<unsigned int, int> lhs;
+    entt::SparseSet<unsigned int, int> rhs;
 
 
     ASSERT_EQ(lhs.construct(1, 0), 0);
     ASSERT_EQ(lhs.construct(1, 0), 0);
     ASSERT_EQ(lhs.construct(2, 0), 0);
     ASSERT_EQ(lhs.construct(2, 0), 0);
@@ -384,7 +359,4 @@ TEST(SparseSetWithType, RespectUnordered) {
     ASSERT_EQ(*(rhs.data() + 3u), 3u);
     ASSERT_EQ(*(rhs.data() + 3u), 3u);
     ASSERT_EQ(*(rhs.data() + 4u), 4u);
     ASSERT_EQ(*(rhs.data() + 4u), 4u);
     ASSERT_EQ(*(rhs.data() + 5u), 5u);
     ASSERT_EQ(*(rhs.data() + 5u), 5u);
-
-    lhs.reset();
-    rhs.reset();
 }
 }

+ 228 - 0
test/entt/entity/view.cpp

@@ -0,0 +1,228 @@
+#include <gtest/gtest.h>
+#include <entt/entity/registry.hpp>
+#include <entt/entity/view.hpp>
+
+TEST(View, SingleComponent) {
+    entt::DefaultRegistry registry;
+
+    auto e1 = registry.create();
+    auto e2 = registry.create<int, char>();
+
+    ASSERT_NO_THROW(registry.view<char>().begin()++);
+    ASSERT_NO_THROW(++registry.view<char>().begin());
+
+    auto view = registry.view<char>();
+
+    ASSERT_NE(view.begin(), view.end());
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
+
+    registry.assign<char>(e1);
+
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{2});
+
+    view.get(e1) = '1';
+    view.get(e2) = '2';
+
+    for(auto entity: view) {
+        const auto &cview = static_cast<const decltype(view) &>(view);
+        ASSERT_TRUE(cview.get(entity) == '1' || cview.get(entity) == '2');
+    }
+
+    ASSERT_EQ(*(view.data() + 0), e2);
+    ASSERT_EQ(*(view.data() + 1), e1);
+
+    ASSERT_EQ(*(view.raw() + 0), '2');
+    ASSERT_EQ(*(static_cast<const decltype(view) &>(view).raw() + 1), '1');
+
+    registry.remove<char>(e1);
+    registry.remove<char>(e2);
+
+    ASSERT_EQ(view.begin(), view.end());
+}
+
+TEST(View, SingleComponentEmpty) {
+    entt::DefaultRegistry registry;
+
+    registry.create<char, double>();
+    registry.create<char>();
+
+    auto view = registry.view<int>();
+
+    ASSERT_EQ(view.size(), entt::DefaultRegistry::size_type{0});
+
+    for(auto entity: view) {
+        (void)entity;
+        FAIL();
+    }
+}
+
+TEST(View, MultipleComponent) {
+    entt::DefaultRegistry registry;
+
+    auto e1 = registry.create<char>();
+    auto e2 = registry.create<int, char>();
+
+    ASSERT_NO_THROW((registry.view<int, char>().begin()++));
+    ASSERT_NO_THROW((++registry.view<int, char>().begin()));
+
+    auto view = registry.view<int, char>();
+
+    ASSERT_NE(view.begin(), view.end());
+
+    view.get<char>(e1) = '1';
+    view.get<char>(e2) = '2';
+
+    for(auto entity: view) {
+        const auto &cview = static_cast<const decltype(view) &>(view);
+        ASSERT_TRUE(cview.get<char>(entity) == '2');
+    }
+
+    registry.remove<char>(e1);
+    registry.remove<char>(e2);
+    view.reset();
+
+    ASSERT_EQ(view.begin(), view.end());
+}
+
+TEST(View, MultipleComponentEmpty) {
+    entt::DefaultRegistry registry;
+
+    registry.create<double, int, float>();
+    registry.create<char, float>();
+
+    auto view = registry.view<char, int, float>();
+
+    for(auto entity: view) {
+        (void)entity;
+        FAIL();
+    }
+}
+
+TEST(PersistentView, MultipleComponentPrepare) {
+    entt::DefaultRegistry registry;
+    registry.prepare<int, char>();
+
+    auto e1 = registry.create<char>();
+    auto e2 = registry.create<int, char>();
+
+    ASSERT_NO_THROW((registry.persistent<int, char>().begin()++));
+    ASSERT_NO_THROW((++registry.persistent<int, char>().begin()));
+
+    auto view = registry.persistent<int, char>();
+
+    ASSERT_NE(view.begin(), view.end());
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
+
+    registry.assign<int>(e1);
+
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{2});
+
+    registry.remove<int>(e1);
+
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
+
+    view.get<char>(e1) = '1';
+    view.get<char>(e2) = '2';
+
+    for(auto entity: view) {
+        const auto &cview = static_cast<const decltype(view) &>(view);
+        ASSERT_TRUE(cview.get<char>(entity) == '2');
+    }
+
+    ASSERT_EQ(*(view.data() + 0), e2);
+
+    registry.remove<char>(e1);
+    registry.remove<char>(e2);
+
+    ASSERT_EQ(view.begin(), view.end());
+}
+
+TEST(PersistentView, MultipleComponentNoPrepare) {
+    entt::DefaultRegistry registry;
+
+    auto e1 = registry.create<char>();
+    auto e2 = registry.create<int, char>();
+
+    ASSERT_NO_THROW((registry.persistent<int, char>().begin()++));
+    ASSERT_NO_THROW((++registry.persistent<int, char>().begin()));
+
+    auto view = registry.persistent<int, char>();
+
+    ASSERT_NE(view.begin(), view.end());
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
+
+    registry.assign<int>(e1);
+
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{2});
+
+    registry.remove<int>(e1);
+
+    ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
+
+    view.get<char>(e1) = '1';
+    view.get<char>(e2) = '2';
+
+    for(auto entity: view) {
+        const auto &cview = static_cast<const decltype(view) &>(view);
+        ASSERT_TRUE(cview.get<char>(entity) == '2');
+    }
+
+    ASSERT_EQ(*(view.data() + 0), e2);
+
+    registry.remove<char>(e1);
+    registry.remove<char>(e2);
+
+    ASSERT_EQ(view.begin(), view.end());
+}
+
+TEST(PersistentView, MultipleComponentEmpty) {
+    entt::DefaultRegistry registry;
+
+    registry.create<double, int, float>();
+    registry.create<char, float>();
+
+    for(auto entity: registry.persistent<char, int, float>()) {
+        (void)entity;
+        FAIL();
+    }
+
+    for(auto entity: registry.persistent<double, char, int, float>()) {
+        (void)entity;
+        FAIL();
+    }
+}
+
+TEST(PersistentView, Sort) {
+    entt::DefaultRegistry registry;
+    registry.prepare<int, unsigned int>();
+
+    auto e1 = registry.create();
+    auto e2 = registry.create();
+    auto e3 = registry.create();
+
+    auto uval = 0u;
+    auto ival = 0;
+
+    registry.assign<unsigned int>(e1, uval++);
+    registry.assign<unsigned int>(e2, uval++);
+    registry.assign<unsigned int>(e3, uval++);
+
+    registry.assign<int>(e1, ival++);
+    registry.assign<int>(e2, ival++);
+    registry.assign<int>(e3, ival++);
+
+    auto view = registry.persistent<int, unsigned int>();
+
+    for(auto entity: view) {
+        ASSERT_EQ(view.get<unsigned int>(entity), --uval);
+        ASSERT_EQ(view.get<int>(entity), --ival);
+    }
+
+    registry.sort<unsigned int>(std::less<unsigned int>{});
+    view.sort<unsigned int>();
+
+    for(auto entity: view) {
+        ASSERT_EQ(view.get<unsigned int>(entity), uval++);
+        ASSERT_EQ(view.get<int>(entity), ival++);
+    }
+}

+ 197 - 0
test/entt/signal/sigh.cpp

@@ -0,0 +1,197 @@
+#include <utility>
+#include <vector>
+#include <gtest/gtest.h>
+#include <entt/signal/sigh.hpp>
+
+TEST(SigH, Lifetime) {
+    using signal = entt::SigH<void(void)>;
+
+    ASSERT_NO_THROW(signal{});
+
+    signal src{}, other{};
+
+    ASSERT_NO_THROW(signal{src});
+    ASSERT_NO_THROW(signal{std::move(other)});
+    ASSERT_NO_THROW(src = other);
+    ASSERT_NO_THROW(src = std::move(other));
+
+    ASSERT_NO_THROW(delete new signal{});
+}
+
+TEST(SigH, Comparison) {
+    struct S {
+        void f() {}
+        void g() {}
+    };
+
+    entt::SigH<void()> sig1;
+    entt::SigH<void()> sig2;
+
+    S s1;
+    S s2;
+
+    sig1.connect<S, &S::f>(&s1);
+    sig2.connect<S, &S::f>(&s2);
+
+    ASSERT_FALSE(sig1 == sig2);
+    ASSERT_TRUE(sig1 != sig2);
+
+    sig1.disconnect<S, &S::f>(&s1);
+    sig2.disconnect<S, &S::f>(&s2);
+
+    sig1.connect<S, &S::f>(&s1);
+    sig2.connect<S, &S::g>(&s1);
+
+    ASSERT_FALSE(sig1 == sig2);
+    ASSERT_TRUE(sig1 != sig2);
+
+    sig1.disconnect<S, &S::f>(&s1);
+    sig2.disconnect<S, &S::g>(&s1);
+
+    ASSERT_TRUE(sig1 == sig2);
+    ASSERT_FALSE(sig1 != sig2);
+
+    sig1.connect<S, &S::f>(&s1);
+    sig1.connect<S, &S::g>(&s1);
+    sig2.connect<S, &S::f>(&s1);
+    sig2.connect<S, &S::g>(&s1);
+
+    ASSERT_TRUE(sig1 == sig2);
+
+    sig1.disconnect<S, &S::f>(&s1);
+    sig1.disconnect<S, &S::g>(&s1);
+    sig2.disconnect<S, &S::f>(&s1);
+    sig2.disconnect<S, &S::g>(&s1);
+
+    sig1.connect<S, &S::f>(&s1);
+    sig1.connect<S, &S::g>(&s1);
+    sig2.connect<S, &S::g>(&s1);
+    sig2.connect<S, &S::f>(&s1);
+
+    ASSERT_FALSE(sig1 == sig2);
+}
+
+struct S {
+    static void f(int &v) { v = 42; }
+};
+
+TEST(SigH, Functions) {
+    entt::SigH<void(int &)> sigh;
+    int v = 0;
+
+    sigh.connect<&S::f>();
+    sigh.publish(v);
+
+    ASSERT_FALSE(sigh.empty());
+    ASSERT_EQ((entt::SigH<bool(int)>::size_type)1, sigh.size());
+    ASSERT_EQ(42, v);
+
+    v = 0;
+    sigh.disconnect<&S::f>();
+    sigh.publish(v);
+
+    ASSERT_TRUE(sigh.empty());
+    ASSERT_EQ((entt::SigH<bool(int)>::size_type)0, sigh.size());
+    ASSERT_EQ(0, v);
+}
+
+TEST(SigH, Members) {
+    struct S {
+        bool f(int) { b = !b; return true; }
+        bool g(int) { return b; }
+        bool b{false};
+    };
+
+    S s;
+    S *ptr = &s;
+    entt::SigH<bool(int)> sigh;
+
+    sigh.connect<S, &S::f>(ptr);
+    sigh.publish(42);
+
+    ASSERT_TRUE(s.b);
+    ASSERT_FALSE(sigh.empty());
+    ASSERT_EQ((entt::SigH<bool(int)>::size_type)1, sigh.size());
+
+    sigh.disconnect<S, &S::f>(ptr);
+    sigh.publish(42);
+
+    ASSERT_TRUE(s.b);
+    ASSERT_TRUE(sigh.empty());
+    ASSERT_EQ((entt::SigH<bool(int)>::size_type)0, sigh.size());
+
+    sigh.connect<S, &S::f>(ptr);
+    sigh.connect<S, &S::g>(ptr);
+
+    ASSERT_FALSE(sigh.empty());
+    ASSERT_EQ((entt::SigH<bool(int)>::size_type)2, sigh.size());
+
+    sigh.disconnect(ptr);
+
+    ASSERT_TRUE(sigh.empty());
+    ASSERT_EQ((entt::SigH<bool(int)>::size_type)0, sigh.size());
+}
+
+template<typename Ret>
+struct TestCollectAll {
+    std::vector<Ret> vec{};
+    static int f() { return 42; }
+    static int g() { return 42; }
+    bool operator()(Ret r) noexcept {
+        vec.push_back(r);
+        return true;
+    }
+};
+
+template<>
+struct TestCollectAll<void> {
+    std::vector<int> vec{};
+    static void h() {}
+    bool operator()() noexcept {
+        return true;
+    }
+};
+
+template<typename Ret>
+struct TestCollectFirst {
+    std::vector<Ret> vec{};
+    static int f() { return 42; }
+    bool operator()(Ret r) noexcept {
+        vec.push_back(r);
+        return false;
+    }
+};
+
+TEST(SigH, Collector) {
+    entt::SigH<void(), TestCollectAll<void>> sigh_void;
+
+    sigh_void.connect<&TestCollectAll<void>::h>();
+    auto collector_void = sigh_void.collect();
+
+    ASSERT_FALSE(sigh_void.empty());
+    ASSERT_TRUE(collector_void.vec.empty());
+
+    entt::SigH<int(), TestCollectAll<int>> sigh_all;
+
+    sigh_all.connect<&TestCollectAll<int>::f>();
+    sigh_all.connect<&TestCollectAll<int>::f>();
+    sigh_all.connect<&TestCollectAll<int>::g>();
+    auto collector_all = sigh_all.collect();
+
+    ASSERT_FALSE(sigh_all.empty());
+    ASSERT_FALSE(collector_all.vec.empty());
+    ASSERT_EQ((std::vector<int>::size_type)2, collector_all.vec.size());
+    ASSERT_EQ(42, collector_all.vec[0]);
+    ASSERT_EQ(42, collector_all.vec[1]);
+
+    entt::SigH<int(), TestCollectFirst<int>> sigh_first;
+
+    sigh_first.connect<&TestCollectFirst<int>::f>();
+    sigh_first.connect<&TestCollectFirst<int>::f>();
+    auto collector_first = sigh_first.collect();
+
+    ASSERT_FALSE(sigh_first.empty());
+    ASSERT_FALSE(collector_first.vec.empty());
+    ASSERT_EQ((std::vector<int>::size_type)1, collector_first.vec.size());
+    ASSERT_EQ(42, collector_first.vec[0]);
+}

+ 1 - 0
test/odr.cpp

@@ -0,0 +1 @@
+#include <entt/entt.hpp>

+ 0 - 357
test/registry.cpp

@@ -1,357 +0,0 @@
-#include <gtest/gtest.h>
-#include <registry.hpp>
-#include <functional>
-
-TEST(DefaultRegistry, Functionalities) {
-    using registry_type = entt::DefaultRegistry<int, char>;
-
-    registry_type registry;
-
-    ASSERT_EQ(registry.size(), registry_type::size_type{0});
-    ASSERT_EQ(registry.capacity(), registry_type::size_type{0});
-    ASSERT_TRUE(registry.empty());
-
-    ASSERT_EQ(registry.size<int>(), registry_type::size_type{0});
-    ASSERT_EQ(registry.size<char>(), registry_type::size_type{0});
-    ASSERT_EQ(registry.capacity<int>(), registry_type::size_type{0});
-    ASSERT_EQ(registry.capacity<char>(), registry_type::size_type{0});
-    ASSERT_TRUE(registry.empty<int>());
-    ASSERT_TRUE(registry.empty<char>());
-
-    registry_type::entity_type e1 = registry.create();
-    registry_type::entity_type e2 = registry.create<int, char>();
-
-    ASSERT_EQ(registry.size<int>(), registry_type::size_type{1});
-    ASSERT_EQ(registry.size<char>(), registry_type::size_type{1});
-    ASSERT_GE(registry.capacity<int>(), registry_type::size_type{1});
-    ASSERT_GE(registry.capacity<char>(), registry_type::size_type{1});
-    ASSERT_FALSE(registry.empty<int>());
-    ASSERT_FALSE(registry.empty<char>());
-
-    ASSERT_NE(e1, e2);
-
-    ASSERT_FALSE(registry.has<int>(e1));
-    ASSERT_TRUE(registry.has<int>(e2));
-    ASSERT_FALSE(registry.has<char>(e1));
-    ASSERT_TRUE(registry.has<char>(e2));
-    ASSERT_TRUE((registry.has<int, char>(e2)));
-    ASSERT_FALSE((registry.has<int, char>(e1)));
-
-    ASSERT_EQ(registry.assign<int>(e1, 42), 42);
-    ASSERT_EQ(registry.assign<char>(e1, 'c'), 'c');
-    ASSERT_NO_THROW(registry.remove<int>(e2));
-    ASSERT_NO_THROW(registry.remove<char>(e2));
-
-    ASSERT_TRUE(registry.has<int>(e1));
-    ASSERT_FALSE(registry.has<int>(e2));
-    ASSERT_TRUE(registry.has<char>(e1));
-    ASSERT_FALSE(registry.has<char>(e2));
-    ASSERT_TRUE((registry.has<int, char>(e1)));
-    ASSERT_FALSE((registry.has<int, char>(e2)));
-
-    registry_type::entity_type e3 = registry.clone(e1);
-
-    ASSERT_TRUE(registry.has<int>(e3));
-    ASSERT_TRUE(registry.has<char>(e3));
-    ASSERT_EQ(registry.get<int>(e1), 42);
-    ASSERT_EQ(registry.get<char>(e1), 'c');
-    ASSERT_EQ(registry.get<int>(e1), registry.get<int>(e3));
-    ASSERT_EQ(registry.get<char>(e1), registry.get<char>(e3));
-    ASSERT_NE(&registry.get<int>(e1), &registry.get<int>(e3));
-    ASSERT_NE(&registry.get<char>(e1), &registry.get<char>(e3));
-
-    ASSERT_NO_THROW(registry.copy(e2, e1));
-    ASSERT_TRUE(registry.has<int>(e2));
-    ASSERT_TRUE(registry.has<char>(e2));
-    ASSERT_EQ(registry.get<int>(e1), 42);
-    ASSERT_EQ(registry.get<char>(e1), 'c');
-    ASSERT_EQ(registry.get<int>(e1), registry.get<int>(e2));
-    ASSERT_EQ(registry.get<char>(e1), registry.get<char>(e2));
-    ASSERT_NE(&registry.get<int>(e1), &registry.get<int>(e2));
-    ASSERT_NE(&registry.get<char>(e1), &registry.get<char>(e2));
-
-    ASSERT_NO_THROW(registry.replace<int>(e1, 0));
-    ASSERT_EQ(registry.get<int>(e1), 0);
-    ASSERT_NO_THROW(registry.copy<int>(e2, e1));
-    ASSERT_EQ(registry.get<int>(e2), 0);
-    ASSERT_NE(&registry.get<int>(e1), &registry.get<int>(e2));
-
-    ASSERT_NO_THROW(registry.remove<int>(e2));
-    ASSERT_NO_THROW(registry.accomodate<int>(e1, 1));
-    ASSERT_NO_THROW(registry.accomodate<int>(e2, 1));
-    ASSERT_EQ(static_cast<const registry_type &>(registry).get<int>(e1), 1);
-    ASSERT_EQ(static_cast<const registry_type &>(registry).get<int>(e2), 1);
-
-    ASSERT_EQ(registry.size(), registry_type::size_type{3});
-    ASSERT_EQ(registry.capacity(), registry_type::size_type{3});
-    ASSERT_FALSE(registry.empty());
-
-    ASSERT_NO_THROW(registry.destroy(e3));
-
-    ASSERT_TRUE(registry.valid(e1));
-    ASSERT_TRUE(registry.valid(e2));
-    ASSERT_FALSE(registry.valid(e3));
-
-    ASSERT_EQ(registry.size(), registry_type::size_type{2});
-    ASSERT_EQ(registry.capacity(), registry_type::size_type{3});
-    ASSERT_FALSE(registry.empty());
-
-    ASSERT_NO_THROW(registry.reset());
-
-    ASSERT_EQ(registry.size(), registry_type::size_type{0});
-    ASSERT_EQ(registry.capacity(), registry_type::size_type{0});
-    ASSERT_TRUE(registry.empty());
-
-    registry.create<int, char>();
-
-    ASSERT_EQ(registry.size<int>(), registry_type::size_type{1});
-    ASSERT_EQ(registry.size<char>(), registry_type::size_type{1});
-    ASSERT_GE(registry.capacity<int>(), registry_type::size_type{1});
-    ASSERT_GE(registry.capacity<char>(), registry_type::size_type{1});
-    ASSERT_FALSE(registry.empty<int>());
-    ASSERT_FALSE(registry.empty<char>());
-
-    ASSERT_NO_THROW(registry.reset<int>());
-
-    ASSERT_EQ(registry.size<int>(), registry_type::size_type{0});
-    ASSERT_EQ(registry.size<char>(), registry_type::size_type{1});
-    ASSERT_GE(registry.capacity<int>(), registry_type::size_type{0});
-    ASSERT_GE(registry.capacity<char>(), registry_type::size_type{1});
-    ASSERT_TRUE(registry.empty<int>());
-    ASSERT_FALSE(registry.empty<char>());
-
-    ASSERT_NO_THROW(registry.reset());
-
-    ASSERT_EQ(registry.size<int>(), registry_type::size_type{0});
-    ASSERT_EQ(registry.size<char>(), registry_type::size_type{0});
-    ASSERT_GE(registry.capacity<int>(), registry_type::size_type{0});
-    ASSERT_GE(registry.capacity<char>(), registry_type::size_type{1});
-    ASSERT_TRUE(registry.empty<int>());
-    ASSERT_TRUE(registry.empty<char>());
-
-    e1 = registry.create<int>();
-    e2 = registry.create();
-
-    ASSERT_NO_THROW(registry.reset<int>(e1));
-    ASSERT_NO_THROW(registry.reset<int>(e2));
-
-    ASSERT_EQ(registry.size<int>(), registry_type::size_type{0});
-    ASSERT_EQ(registry.size<char>(), registry_type::size_type{0});
-    ASSERT_GE(registry.capacity<int>(), registry_type::size_type{0});
-    ASSERT_GE(registry.capacity<char>(), registry_type::size_type{0});
-    ASSERT_TRUE(registry.empty<int>());
-}
-
-TEST(DefaultRegistry, Copy) {
-    using registry_type = entt::DefaultRegistry<int, char, double>;
-
-    registry_type registry;
-
-    registry_type::entity_type e1 = registry.create<int, char>();
-    registry_type::entity_type e2 = registry.create<int, double>();
-
-    ASSERT_TRUE(registry.has<int>(e1));
-    ASSERT_TRUE(registry.has<char>(e1));
-    ASSERT_FALSE(registry.has<double>(e1));
-
-    ASSERT_TRUE(registry.has<int>(e2));
-    ASSERT_FALSE(registry.has<char>(e2));
-    ASSERT_TRUE(registry.has<double>(e2));
-
-    ASSERT_NO_THROW(registry.copy(e2, e1));
-
-    ASSERT_TRUE(registry.has<int>(e1));
-    ASSERT_TRUE(registry.has<char>(e1));
-    ASSERT_FALSE(registry.has<double>(e1));
-
-    ASSERT_TRUE(registry.has<int>(e2));
-    ASSERT_TRUE(registry.has<char>(e2));
-    ASSERT_FALSE(registry.has<double>(e2));
-
-    ASSERT_FALSE(registry.empty<int>());
-    ASSERT_FALSE(registry.empty<char>());
-    ASSERT_TRUE(registry.empty<double>());
-
-    registry.reset();
-}
-
-TEST(DefaultRegistry, Swap) {
-    using registry_type = entt::DefaultRegistry<int, char>;
-
-    registry_type registry;
-
-    registry_type::entity_type e1 = registry.create<int, char>();
-    registry_type::entity_type e2 = registry.create<int, char>();
-
-    registry.get<int>(e1) = 0;
-    registry.get<char>(e1) = 'a';
-    registry.get<int>(e2) = 1;
-    registry.get<char>(e2) = 'b';
-
-    registry.swap<int>(e1, e2);
-
-    ASSERT_EQ(registry.get<int>(e1), 1);
-    ASSERT_EQ(registry.get<char>(e1), 'a');
-    ASSERT_EQ(registry.get<int>(e2), 0);
-    ASSERT_EQ(registry.get<char>(e2), 'b');
-
-    registry.reset();
-}
-
-TEST(DefaultRegistry, SortSingle) {
-    using registry_type = entt::DefaultRegistry<int>;
-
-    registry_type registry;
-
-    registry_type::entity_type e1 = registry.create();
-    registry_type::entity_type e2 = registry.create();
-    registry_type::entity_type e3 = registry.create();
-
-    auto val = 0;
-
-    registry.assign<int>(e1, val++);
-    registry.assign<int>(e2, val++);
-    registry.assign<int>(e3, val++);
-
-    for(auto entity: registry.view<int>()) {
-        ASSERT_EQ(registry.get<int>(entity), --val);
-    }
-
-    registry.sort<int>(std::less<int>{});
-
-    for(auto entity: registry.view<int>()) {
-        ASSERT_EQ(registry.get<int>(entity), val++);
-    }
-
-    registry.reset();
-}
-
-TEST(DefaultRegistry, SortMulti) {
-    using registry_type = entt::DefaultRegistry<int, unsigned int>;
-
-    registry_type registry;
-
-    registry_type::entity_type e1 = registry.create();
-    registry_type::entity_type e2 = registry.create();
-    registry_type::entity_type e3 = registry.create();
-
-    auto uval = 0u;
-    auto ival = 0;
-
-    registry.assign<unsigned int>(e1, uval++);
-    registry.assign<unsigned int>(e2, uval++);
-    registry.assign<unsigned int>(e3, uval++);
-
-    registry.assign<int>(e1, ival++);
-    registry.assign<int>(e2, ival++);
-    registry.assign<int>(e3, ival++);
-
-    for(auto entity: registry.view<unsigned int>()) {
-        ASSERT_EQ(registry.get<unsigned int>(entity), --uval);
-    }
-
-    for(auto entity: registry.view<int>()) {
-        ASSERT_EQ(registry.get<int>(entity), --ival);
-    }
-
-    registry.sort<unsigned int>(std::less<unsigned int>{});
-    registry.sort<int, unsigned int>();
-
-    for(auto entity: registry.view<unsigned int>()) {
-        ASSERT_EQ(registry.get<unsigned int>(entity), uval++);
-    }
-
-    for(auto entity: registry.view<int>()) {
-        ASSERT_EQ(registry.get<int>(entity), ival++);
-    }
-
-    registry.reset();
-}
-
-TEST(DefaultRegistry, ViewSingleComponent) {
-    using registry_type = entt::DefaultRegistry<int, char>;
-
-    registry_type registry;
-
-    registry_type::entity_type e1 = registry.create();
-    registry_type::entity_type e2 = registry.create<int, char>();
-
-    ASSERT_NO_THROW(registry.view<char>().begin()++);
-    ASSERT_NO_THROW(++registry.view<char>().begin());
-
-    auto view = registry.view<char>();
-
-    ASSERT_NE(view.begin(), view.end());
-    ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
-
-    registry.assign<char>(e1);
-
-    ASSERT_EQ(view.size(), typename decltype(view)::size_type{2});
-
-    registry.remove<char>(e1);
-    registry.remove<char>(e2);
-
-    ASSERT_EQ(view.begin(), view.end());
-    ASSERT_NO_THROW(registry.reset());
-}
-
-TEST(DefaultRegistry, ViewMultipleComponent) {
-    using registry_type = entt::DefaultRegistry<int, char>;
-
-    registry_type registry;
-
-    registry_type::entity_type e1 = registry.create<char>();
-    registry_type::entity_type e2 = registry.create<int, char>();
-
-    ASSERT_NO_THROW((registry.view<int, char>().begin()++));
-    ASSERT_NO_THROW((++registry.view<int, char>().begin()));
-
-    auto view = registry.view<int, char>();
-
-    ASSERT_NE(view.begin(), view.end());
-
-    registry.remove<char>(e1);
-    registry.remove<char>(e2);
-    view.reset();
-
-    ASSERT_EQ(view.begin(), view.end());
-    ASSERT_NO_THROW(registry.reset());
-}
-
-TEST(DefaultRegistry, ViewSingleComponentEmpty) {
-    using registry_type = entt::DefaultRegistry<char, int, double>;
-
-    registry_type registry;
-
-    registry.create<char, double>();
-    registry.create<char>();
-
-    auto view = registry.view<int>();
-
-    ASSERT_EQ(view.size(), registry_type::size_type{0});
-
-    for(auto entity: view) {
-        (void)entity;
-        FAIL();
-    }
-
-    registry.reset();
-}
-
-TEST(DefaultRegistry, ViewMultipleComponentEmpty) {
-    using registry_type = entt::DefaultRegistry<char, int, float, double>;
-
-    registry_type registry;
-
-    registry.create<double, int, float>();
-    registry.create<char, float>();
-
-    auto view = registry.view<char, int, float>();
-
-    for(auto entity: view) {
-        (void)entity;
-        FAIL();
-    }
-
-    registry.reset();
-}