diff --git a/include/fmt/format.h b/include/fmt/format.h index 7993b823..c351c1ba 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2611,14 +2611,14 @@ template <> struct formatter { } }; -// thousands_view is not derived from view because it copies the argument. -template struct thousands_view { T value; }; +// group_digits_view is not derived from view because it copies the argument. +template struct group_digits_view { T value; }; -template auto thousands(T value) -> thousands_view { +template auto group_digits(T value) -> group_digits_view { return {value}; } -template struct formatter> : formatter { +template struct formatter> : formatter { private: detail::dynamic_format_specs specs_; @@ -2634,7 +2634,7 @@ template struct formatter> : formatter { } template - auto format(thousands_view t, FormatContext& ctx) -> decltype(ctx.out()) { + auto format(group_digits_view t, FormatContext& ctx) -> decltype(ctx.out()) { detail::handle_dynamic_spec(specs_.width, specs_.width_ref, ctx); detail::handle_dynamic_spec( diff --git a/test/format-test.cc b/test/format-test.cc index 93b5d308..d6c68922 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1595,9 +1595,9 @@ TEST(format_test, bytes) { EXPECT_EQ(10, s.size()); } -TEST(format_test, thousands) { - EXPECT_EQ(fmt::format("{}", fmt::thousands(10000000)), "10,000,000"); - EXPECT_EQ(fmt::format("{:8}", fmt::thousands(1000)), " 1,000"); +TEST(format_test, group_digits_view) { + EXPECT_EQ(fmt::format("{}", fmt::group_digits(10000000)), "10,000,000"); + EXPECT_EQ(fmt::format("{:8}", fmt::group_digits(1000)), " 1,000"); } enum test_enum { foo, bar };