Quellcode durchsuchen

Export user_type_id and user_type_reg_name globally to avoid overlapping user types IDs

Ole vor 10 Jahren
Ursprung
Commit
bc28ba76b5
1 geänderte Dateien mit 4 neuen und 5 gelöschten Zeilen
  1. 4 5
      lib/luwra/usertypes.hpp

+ 4 - 5
lib/luwra/usertypes.hpp

@@ -25,15 +25,14 @@ namespace internal {
 	/**
 	 * User type identifier
 	 */
-	template <typename T>
-	UserTypeID user_type_id = (void*) INTPTR_MAX;
+	template <typename T> extern
+	const UserTypeID user_type_id = (void*) INTPTR_MAX;
 
-	// TODO: Figure out why qualifying `user_type_reg_name` with `static` or `const` causes trouble
 	/**
 	 * Registry name for a metatable which is associated with a user type
 	 */
-	template <typename T>
-	std::string user_type_reg_name =
+	template <typename T> extern
+	const std::string user_type_reg_name =
 		"UD#" + std::to_string(uintptr_t(&user_type_id<StripUserType<T>>));
 
 	/**