mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Added missing typename to FMT_STRING. (#1089)
* Added missing typename to FMT_STRING. This is so that FMT_STRING can be used in a template.
This commit is contained in:
committed by
Victor Zverovich
parent
f0b572da05
commit
7ad3015f5b
@ -3619,7 +3619,8 @@ FMT_END_NAMESPACE
|
|||||||
} \
|
} \
|
||||||
} result; \
|
} result; \
|
||||||
/* Suppress Qt Creator warning about unused operator. */ \
|
/* Suppress Qt Creator warning about unused operator. */ \
|
||||||
(void)static_cast<fmt::basic_string_view<str::char_type>>(result); \
|
(void)static_cast<fmt::basic_string_view<typename str::char_type>>( \
|
||||||
|
result); \
|
||||||
return result; \
|
return result; \
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -2475,6 +2475,15 @@ TEST(FormatTest, VFormatTo) {
|
|||||||
EXPECT_EQ(L"42", w);
|
EXPECT_EQ(L"42", w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T> static std::string FmtToString(const T& t) {
|
||||||
|
return fmt::format(FMT_STRING("{}"), t);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(FormatTest, FmtStringInTemplate) {
|
||||||
|
EXPECT_EQ(FmtToString(1), "1");
|
||||||
|
EXPECT_EQ(FmtToString(0), "0");
|
||||||
|
}
|
||||||
|
|
||||||
#endif // FMT_USE_CONSTEXPR
|
#endif // FMT_USE_CONSTEXPR
|
||||||
|
|
||||||
TEST(FormatTest, ConstructU8StringViewFromCString) {
|
TEST(FormatTest, ConstructU8StringViewFromCString) {
|
||||||
|
Reference in New Issue
Block a user