Divergence between std and fmt on ranges formatting

Open
#5,004 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 9 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
63/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
tooling

Research direction

Run the provided C++ example and compare fmt::println with std::println for the repeated-character view. Read the range-formatting implementation and its existing tests to locate how {:s} handles this range. Done means a regression test confirms fmt matches the standard library's unquoted output.

Written by the indexing model from the issue text.

Description

fmt emits surrouding quotes on {:s}, while std doesn't

#include <fmt/format.h>
#include <fmt/ranges.h>
#include <fmt/std.h>
#include <print>
#include <algorithm>
#include <ranges>

int main() {
    std::println("...{:s}...", std::views::repeat('x', 4)); // prints ...xxxx...
    fmt::println("...{:s}...", std::views::repeat('x', 4)); // prints ..."xxxx"...
}

https://godbolt.org/z/3ezsWYhvE

Dominant language
C++
Stars
25.9k
Forks
3.1k
Avg merge
9d 5h
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fmtlib/fmt

All issues in fmtlib/fmt

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.