Преглед изворни кода

Prevent name collisions in the registry

Ole пре 9 година
родитељ
комит
daa16fb669
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      lib/luwra/usertypes.hpp

+ 5 - 1
lib/luwra/usertypes.hpp

@@ -41,8 +41,12 @@ namespace internal {
 	template <typename T>
 	const int UserTypeReg<T>::id = INT_MAX;
 
+	#ifndef LUWRA_REGISTRY_PREFIX
+		#define LUWRA_REGISTRY_PREFIX "Luwra#"
+	#endif
+
 	template <typename T>
-	const std::string UserTypeReg<T>::name = "UD#" + std::to_string(uintptr_t(&id));
+	const std::string UserTypeReg<T>::name = LUWRA_REGISTRY_PREFIX + std::to_string(uintptr_t(&id));
 
 	/**
 	 * Register a new metatable for a user type T.