Parcourir la Source

Export user_type_id and user_type_reg_name globally to avoid overlapping user types IDs

Ole il y a 10 ans
Parent
commit
bc28ba76b5
1 fichiers modifiés avec 4 ajouts et 5 suppressions
  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>>));
 
 	/**