Explorar o código

Add alias Value specialization for string literals

Ole %!s(int64=10) %!d(string=hai) anos
pai
achega
96929feda3
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      lib/luwra/types.hpp

+ 8 - 0
lib/luwra/types.hpp

@@ -223,6 +223,14 @@ LUWRA_DEF_VALUE(std::string, luaL_checkstring,  luaL_pushstdstring);
 #undef LUWRA_DEF_VALUE
 #undef LUWRA_DEF_NUMERIC
 
+// Alias for string literals
+template <size_t n>
+struct Value<char[n]>: Value<const char*> {};
+
+// Alias for const string literals
+template <size_t n>
+struct Value<const char[n]>: Value<const char*> {};
+
 /**
  * C Functions may be pushed aswell.
  */