aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/Util.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-01-07 22:38:21 +0100
committerShauren <shauren.trinity@gmail.com>2023-08-12 17:56:16 +0200
commit27cd5a90f4c1f34c47cd4e1bd1a616e9b11b10ec (patch)
tree4e8b102f603a7ed0e3dea1a37274774a78127423 /src/common/Utilities/Util.h
parentd251ab647dd4f48603b37b7150627a39e9a30f45 (diff)
Core/Misc: Replace enable_if overload selection with if constexpr
(cherry picked from commit a53e4a57565d3375a978effbbc32d3eed6aac7e3)
Diffstat (limited to 'src/common/Utilities/Util.h')
-rw-r--r--src/common/Utilities/Util.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index 87dd45d3cbc..d37b86f85e5 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -557,10 +557,23 @@ Ret* Coalesce(T1* first, T*... rest)
return static_cast<Ret*>(first);
}
-TC_COMMON_API std::string GetTypeName(std::type_info const&);
+namespace Trinity
+{
+namespace Impl
+{
+ TC_COMMON_API std::string GetTypeName(std::type_info const&);
+}
+
template <typename T>
-std::string GetTypeName() { return GetTypeName(typeid(T)); }
+std::string GetTypeName() { return Impl::GetTypeName(typeid(T)); }
template <typename T>
-std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::type_info>, std::string> GetTypeName(T&& v) { return GetTypeName(typeid(v)); }
+std::string GetTypeName(T&& v)
+{
+ if constexpr (std::is_same_v<std::remove_cv_t<T>, std::type_info>)
+ return Impl::GetTypeName(v);
+ else
+ return Impl::GetTypeName(typeid(v));
+}
+}
#endif