diff --git a/include/fmt/core.h b/include/fmt/core.h index c6c44e53..2c83f045 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -493,6 +493,12 @@ template struct format_string_traits> : format_string_traits_base {}; +#ifdef FMT_STRING_VIEW +template +struct format_string_traits> : + format_string_traits_base {}; +#endif + template struct format_string_traits< S, typename std::enable_if::value)); } +template +class IsStringTest : public testing::Test {}; + +typedef ::testing::Types StringCharTypes; +TYPED_TEST_CASE(IsStringTest, StringCharTypes); + +namespace { +template +struct derived_from_string_view : fmt::basic_string_view {}; +} + +TYPED_TEST(IsStringTest, IsString) { + EXPECT_TRUE((fmt::internal::is_string::value)); + EXPECT_TRUE((fmt::internal::is_string::value)); + EXPECT_TRUE((fmt::internal::is_string::value)); + EXPECT_TRUE((fmt::internal::is_string::value)); + EXPECT_TRUE((fmt::internal::is_string>::value)); + EXPECT_TRUE((fmt::internal::is_string>::value)); + EXPECT_TRUE((fmt::internal::is_string>::value)); +#ifdef FMT_STRING_VIEW + EXPECT_TRUE((fmt::internal::is_string>::value)); +#endif +} + TEST(CoreTest, Format) { // This should work without including fmt/format.h. #ifdef FMT_FORMAT_H_