Sfoglia il codice sorgente

table: refine prototype

Michele Caini 1 anno fa
parent
commit
b69390f283
3 ha cambiato i file con 13 aggiunte e 2 eliminazioni
  1. 10 0
      src/entt/entity/fwd.hpp
  2. 2 1
      src/entt/entity/table.hpp
  3. 1 1
      test/entt/entity/table.cpp

+ 10 - 0
src/entt/entity/fwd.hpp

@@ -28,6 +28,9 @@ class basic_sparse_set;
 template<typename Type, typename = entity, typename = std::allocator<Type>, typename = void>
 class basic_storage;
 
+template<typename, typename = std::allocator<void>>
+class basic_table;
+
 template<typename, typename>
 class basic_sigh_mixin;
 
@@ -71,6 +74,13 @@ using sparse_set = basic_sparse_set<>;
 template<typename Type>
 using storage = basic_storage<Type>;
 
+/**
+ * @brief Alias declaration for the most common use case.
+ * @tparam Type Element types.
+ */
+template<typename... Type>
+using table = basic_table<type_list<Type...>>;
+
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Type Underlying storage type.

+ 2 - 1
src/entt/entity/table.hpp

@@ -5,7 +5,8 @@
 
 namespace entt {
 
-struct basic_table {
+template<typename... Type, typename Allocator>
+struct basic_table<type_list<Type...>, Allocator> {
 };
 
 } // namespace entt

+ 1 - 1
test/entt/entity/table.cpp

@@ -2,5 +2,5 @@
 #include <entt/entity/table.hpp>
 
 TEST(Table, Placeholder) {
-    entt::basic_table table{};
+    entt::table<int, char> table{};
 }