Przeglądaj źródła

table: refine prototype

Michele Caini 1 rok temu
rodzic
commit
b69390f283

+ 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>
 template<typename Type, typename = entity, typename = std::allocator<Type>, typename = void>
 class basic_storage;
 class basic_storage;
 
 
+template<typename, typename = std::allocator<void>>
+class basic_table;
+
 template<typename, typename>
 template<typename, typename>
 class basic_sigh_mixin;
 class basic_sigh_mixin;
 
 
@@ -71,6 +74,13 @@ using sparse_set = basic_sparse_set<>;
 template<typename Type>
 template<typename Type>
 using storage = basic_storage<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.
  * @brief Alias declaration for the most common use case.
  * @tparam Type Underlying storage type.
  * @tparam Type Underlying storage type.

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

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

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

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