Skip to content

Commit 58998e5

Browse files
committed
兼容const char *
1 parent b30575c commit 58998e5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/Util/format.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ std::string toFormatString(T t)
4242
{
4343
return t;
4444
}
45+
else if constexpr (std::is_same_v<T, const char *>)
46+
{
47+
return std::string(t);
48+
}
4549
else
4650
{
4751
return std::to_string(t);
@@ -67,6 +71,12 @@ inline std::string toFormatString(std::string_view t)
6771
return std::string(t);
6872
}
6973

74+
template <>
75+
inline std::string toFormatString(const char* t)
76+
{
77+
return std::string(t);
78+
}
79+
7080
#endif
7181

7282

0 commit comments

Comments
 (0)