We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30024f8 commit f6cc429Copy full SHA for f6cc429
src/cppscript_defs.h
@@ -60,4 +60,12 @@ static inline s_type& s_name = *reinterpret_cast<s_type*>(&s_name ## _impl);
60
namespace impl {
61
struct StaticAccess;
62
};
63
+
64
+/* Similar to Godot engine's SNAME macro idea or GDScript's `&"string_name"` syntax,
65
+ * it creates static instance of StringName and returns reference to it.
66
+ * It guarantees that `StringName` exists before calling this lambda,
67
+ * but not that `StringName`s with same string literal are the same object.
68
+ */
69
+#define SNAME(str_literal) ([]() -> const ::godot::StringName& {static const ::godot::StringName str(str_literal); return str;}())
70
71
#endif // CPPSCRIPT_HEADER
0 commit comments