Fix formatting of objects convertible to string_view

This commit is contained in:
Victor Zverovich
2018-02-19 20:25:56 +00:00
parent e508e30800
commit 24d249b0b4
2 changed files with 11 additions and 1 deletions

View File

@@ -1223,6 +1223,14 @@ TEST(FormatterTest, FormatConvertibleToString) {
EXPECT_EQ("foo", format("{}", ConvertibleToString()));
}
struct ConvertibleToStringView {
operator fmt::string_view() const { return "foo"; }
};
TEST(FormatterTest, FormatConvertibleToStringView) {
EXPECT_EQ("foo", format("{}", ConvertibleToStringView()));
}
namespace fmt {
template <>
struct formatter<Date> {