summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-18 10:21:17 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-18 10:27:54 +0100
commit2c51f2caa6ffe1334670d8c43b919f8dc4abb98a (patch)
tree27df2f357103832bd28fc8a633d1698445ae93b5
parent14d316a0261fb2a3541d27790cb7dc58e40de35c (diff)
make the mangled name from `name_of` shorter
-rw-r--r--src/entity.hpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/entity.hpp b/src/entity.hpp
index b1211d0b..0f7ccbe0 100644
--- a/src/entity.hpp
+++ b/src/entity.hpp
@@ -16,14 +16,15 @@
#define FM_PRETTY_FUNCTION __PRETTY_FUNCTION__
#endif
-namespace floormat::entities::detail {
-template<typename T> static constexpr StringView type_name();
-template<typename T> struct type_name_helper;
+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 };
}
-namespace floormat {
-template<typename T> constexpr inline StringView name_of = entities::detail::type_name_helper<T>::name;
-} // namespace floormat
+template<typename T> constexpr inline Corrade::Containers::StringView name_of = _name_of<T>();
namespace floormat::entities {
@@ -82,20 +83,6 @@ concept FieldWriter = requires {
namespace detail {
-template<typename T>
-static constexpr StringView type_name() {
- 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>
-struct type_name_helper final
-{
- static constexpr const StringView name = type_name<T>();
-};
-
template<typename Obj, typename Type, FieldReader<Obj, Type> R>
struct read_field {
static constexpr Type read(const Obj& x, R r) { return r(x); }