Disable is_streamable for string[_view]

This commit is contained in:
Victor Zverovich 2021-12-09 09:48:55 -08:00
parent 91533d3c33
commit e4f0564aa6
2 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,8 @@ struct is_streamable<
enable_if_t<
std::is_arithmetic<T>::value || std::is_array<T>::value ||
std::is_pointer<T>::value || std::is_same<T, char8_type>::value ||
std::is_same<T, std::basic_string<Char>>::value ||
std::is_same<T, std_string_view<Char>>::value ||
(std::is_convertible<T, int>::value && !std::is_enum<T>::value)>>
: std::false_type {};

View File

@ -294,3 +294,8 @@ struct abstract {
void format_abstract_compiles(const abstract& a) {
fmt::format(FMT_COMPILE("{}"), a);
}
TEST(ostream_test, is_formattable) {
EXPECT_TRUE(fmt::is_formattable<std::string>());
EXPECT_TRUE(fmt::is_formattable<fmt::detail::std_string_view<char>>());
}