summaryrefslogtreecommitdiffhomepage
path: root/entity/name-of.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'entity/name-of.hpp')
-rw-r--r--entity/name-of.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/entity/name-of.hpp b/entity/name-of.hpp
new file mode 100644
index 00000000..592f07c1
--- /dev/null
+++ b/entity/name-of.hpp
@@ -0,0 +1,18 @@
+#pragma once
+#include <Corrade/Containers/StringView.h>
+
+#if defined _MSC_VER
+#define FM_PRETTY_FUNCTION __FUNCSIG__
+#else
+#define FM_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#endif
+
+template<typename T>
+static constexpr auto _name_of() {
+ using namespace Corrade::Containers;
+ using SVF = StringViewFlag;
+ constexpr const char* str = FM_PRETTY_FUNCTION;
+ return StringView { str, Implementation::strlen_(str), SVF::Global|SVF::NullTerminated };
+}
+
+template<typename T> constexpr inline Corrade::Containers::StringView name_of = _name_of<T>();