Commit a291f07e authored by Victor Zverovich's avatar Victor Zverovich

Clean up argument mapping

parent 5d9100fa
This diff is collapsed.
...@@ -3025,7 +3025,7 @@ class format_int { ...@@ -3025,7 +3025,7 @@ class format_int {
template <typename T, typename Char> template <typename T, typename Char>
struct formatter<T, Char, struct formatter<T, Char,
enable_if_t<internal::type_constant<T, Char>::value != enable_if_t<internal::type_constant<T, Char>::value !=
internal::none_type>> { internal::custom_type>> {
FMT_CONSTEXPR formatter() : format_str_(nullptr) {} FMT_CONSTEXPR formatter() : format_str_(nullptr) {}
// Parses format specifiers stopping either at the end of the range or at the // Parses format specifiers stopping either at the end of the range or at the
......
...@@ -229,8 +229,8 @@ struct custom_context { ...@@ -229,8 +229,8 @@ struct custom_context {
TEST(ArgTest, MakeValueWithCustomContext) { TEST(ArgTest, MakeValueWithCustomContext) {
test_struct t; test_struct t;
fmt::internal::value<custom_context> arg = fmt::internal::value<custom_context> arg(
fmt::internal::make_value<custom_context>(t); fmt::internal::arg_mapper<custom_context>().map(t));
custom_context ctx = {false, fmt::format_parse_context("")}; custom_context ctx = {false, fmt::format_parse_context("")};
arg.custom.format(&t, ctx.parse_context(), ctx); arg.custom.format(&t, ctx.parse_context(), ctx);
EXPECT_TRUE(ctx.called); EXPECT_TRUE(ctx.called);
...@@ -588,6 +588,10 @@ TEST(CoreTest, FormatForeignStrings) { ...@@ -588,6 +588,10 @@ TEST(CoreTest, FormatForeignStrings) {
EXPECT_EQ(fmt::format(my_string<wchar_t>(L"{}"), QString(L"42")), L"42"); EXPECT_EQ(fmt::format(my_string<wchar_t>(L"{}"), QString(L"42")), L"42");
} }
struct implicitly_convertible_to_string {
operator std::string() const { return "foo"; }
};
struct implicitly_convertible_to_string_view { struct implicitly_convertible_to_string_view {
operator fmt::string_view() const { return "foo"; } operator fmt::string_view() const { return "foo"; }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment