Ver código fonte

Add namespace resolve macro for VS C++ compat

Ole 9 anos atrás
pai
commit
3b174a716f
3 arquivos alterados com 15 adições e 5 exclusões
  1. 6 0
      lib/luwra/compat.hpp
  2. 1 2
      lib/luwra/generic.hpp
  3. 8 3
      lib/luwra/usertypes.hpp

+ 6 - 0
lib/luwra/compat.hpp

@@ -31,4 +31,10 @@ namespace internal {
 
 LUWRA_NS_END
 
+#ifdef _MSC_VER // Because VS C++
+	#define __LUWRA_NS_RESOLVE(a, b) a::##b
+#else
+	#define __LUWRA_NS_RESOLVE(a, b) a::b
+#endif
+
 #endif

+ 1 - 2
lib/luwra/generic.hpp

@@ -60,8 +60,7 @@ LUWRA_NS_END
 #define LUWRA_WRAP(entity) \
 	(&luwra::internal::GenericWrapper<decltype(&entity)>::template invoke<&entity>)
 
-// This verions is standard and works with every compiler
 #define LUWRA_MEMBER(type, name) \
-	{#name, LUWRA_WRAP(type::##name)}
+	{#name, LUWRA_WRAP(__LUWRA_NS_RESOLVE(type, name))}
 
 #endif

+ 8 - 3
lib/luwra/usertypes.hpp

@@ -327,8 +327,13 @@ LUWRA_NS_END
 	} \
 	LUWRA_NS_END
 
-#define LUWRA_FIELD(type, name) {#name), LUWRA_WRAP_FIELD(type::##name)}
-#define LUWRA_METHOD(type, name) {#name), LUWRA_WRAP_METHOD(type::##name)}
-#define LUWRA_FUNCTION(type, name) {#name), LUWRA_WRAP_FUNCTION(type::##name)}
+#define LUWRA_FIELD(type, name) \
+	{#name, LUWRA_WRAP_FIELD(__LUWRA_NS_RESOLVE(type, name))}
+
+#define LUWRA_METHOD(type, name) \
+	{#name, LUWRA_WRAP_METHOD(__LUWRA_NS_RESOLVE(type, name))}
+
+#define LUWRA_FUNCTION(type, name) \
+	{#name, LUWRA_WRAP_FUNCTION(__LUWRA_NS_RESOLVE(type, name))}
 
 #endif