Add support for types explicitly convertible to wstring_view

This commit is contained in:
Victor Zverovich
2018-07-18 19:12:10 -07:00
parent 50584f42b4
commit cf2719bd12
2 changed files with 10 additions and 2 deletions

View File

@@ -1103,6 +1103,14 @@ TEST(FormatterTest, FormatExplicitlyConvertibleToStringView) {
EXPECT_EQ("foo", format("{}", explicitly_convertible_to_string_view()));
}
struct explicitly_convertible_to_wstring_view {
explicit operator fmt::wstring_view() const { return L"foo"; }
};
TEST(FormatterTest, FormatExplicitlyConvertibleToWStringView) {
EXPECT_EQ(L"foo", format(L"{}", explicitly_convertible_to_wstring_view()));
}
struct explicitly_convertible_to_string_like {
template <
typename String,