Skip to content

Commit

Permalink
[libc++][format] Improve floating-point formatters.
Browse files Browse the repository at this point in the history
This changes the implementation of the formatter. Instead of inheriting
from a specialized parser all formatters will use the same generic
parser. This reduces the binary size.

The new parser contains some additional fields only used in the chrono
formatting. Since this doesn't change the size of the parser the fields
are in the generic parser. The parser is designed to fit in 128-bit,
making it cheap to pass by value.

The new format function is a const member function. This isn't required
by the Standard yet, but it will be after LWG-3636 is accepted.
Additionally P2286 adds a formattable concept which requires the member
function to be const qualified in C++23. This paper is likely to be
accepted in the 2022 July plenary.

This is based on D125606. That commit did the groundwork and did similar
changes for the string formatters.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D128785
  • Loading branch information
mordante committed Jul 7, 2022
1 parent 0826a56 commit 152d922
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 555 deletions.

0 comments on commit 152d922

Please sign in to comment.