Pārlūkot izejas kodu

Add alias Value specialization for string literals

Ole 10 gadi atpakaļ
vecāks
revīzija
96929feda3
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  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.
  */