fmt::formatted_size does not work with fmt::wformat_string

Open Beginner friendly
#5,013 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 9 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start by reading the declaration and implementation of fmt::formatted_size and how detail::format_string_char_t<S> handles fmt::wformat_string. Add support for the wide format string overload and check the existing formatted_size tests for a place to cover it. Done when the wide string case compiles and reports the formatted output size.

Written by the indexing model from the issue text.

Description

I maintain a library at my work that supports both char and wchar strings. We use fmt::formatted_size to help us mange our memory allocations, but it does not work with fmt::wformat_string, requiring me to maintain a fork that adds this support.

The crux of the issue is that detail::format_string_char_t<S> does not provide a value when S is a fmt::wformat_string. Adding an overload of fmt::formatted_size that takes a fmt::wformat_string specifically resolves the issue. I unfortunately do not currently have legal approval to provide that patch upstream, so I am making this issue to raise the problem and hopefully someone will be able to contribute the necessary fix.

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.