summaryrefslogtreecommitdiffhomepage
path: root/entity/name-of.hpp
blob: 2f86d9b8057ed364c279df4556b725a18be345ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 mangled_name() { // NOLINT(bugprone-reserved-identifier)
    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 auto name_of = mangled_name<T>();