Browse Source

runtime_view: remove the dependency on the sparse set class

Michele Caini 3 years ago
parent
commit
95b91cd7dd
1 changed files with 6 additions and 17 deletions
  1. 6 17
      src/entt/entity/runtime_view.hpp

+ 6 - 17
src/entt/entity/runtime_view.hpp

@@ -2,13 +2,12 @@
 #define ENTT_ENTITY_RUNTIME_VIEW_HPP
 
 #include <algorithm>
+#include <cstddef>
 #include <iterator>
-#include <type_traits>
 #include <utility>
 #include <vector>
 #include "entity.hpp"
 #include "fwd.hpp"
-#include "sparse_set.hpp"
 
 namespace entt {
 
@@ -102,15 +101,6 @@ private:
  * @endcond
  */
 
-/**
- * @brief Runtime view implementation.
- *
- * Primary template isn't defined on purpose. All the specializations give a
- * compile-time error, but for a few reasonable cases.
- */
-template<typename>
-struct basic_runtime_view;
-
 /**
  * @brief Generic runtime view.
  *
@@ -147,17 +137,16 @@ struct basic_runtime_view;
  * Lifetime of a view must not overcome that of the registry that generated it.
  * In any other case, attempting to use a view results in undefined behavior.
  *
- * @tparam Entity A valid entity type (see entt_traits for more details).
- * @tparam Allocator Type of allocator used to manage memory and elements.
+ * @tparam Type Common base type.
  */
-template<typename Entity, typename Allocator>
-struct basic_runtime_view<basic_sparse_set<Entity, Allocator>> {
+template<typename Type>
+struct basic_runtime_view {
     /*! @brief Underlying entity identifier. */
-    using entity_type = Entity;
+    using entity_type = typename Type::entity_type;
     /*! @brief Unsigned integer type. */
     using size_type = std::size_t;
     /*! @brief Common type among all storage types. */
-    using base_type = basic_sparse_set<Entity, Allocator>;
+    using base_type = Type;
     /*! @brief Bidirectional iterator type. */
     using iterator = internal::runtime_view_iterator<base_type>;