This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

3327. Format alignment specifiers vs. text direction

Section: 22.14.2.2 [format.string.std] Status: C++20 Submitter: Great Britain Opened: 2019-11-07 Last modified: 2021-02-25

Priority: 0

View other active issues in [format.string.std].

View all other issues in [format.string.std].

View all issues with C++20 status.

Discussion:

Addresses GB 225

std::format() alignment specifiers should be independent of text direction The align specifiers for formatting standard integer and string types are expressed in terms of "left" and "right". However, "left alignment" as currently defined in the format() specification might end up being right-aligned when the resulting string is displayed in a RTL or bidirectional locale. This ambiguity can be resolved by removing "left" and "right" and replacing with "start" and "end", without changing any existing implementation and without changing the intent of the feature.

Proposed change:

In [tab:format.align]: Forces the field to be left-aligned within aligned to the start of the available space and Forces the field to be right-aligned within aligned to the end of the available space

Jeff Garland:

Wiki notes from Belfast Wed:

# GB225

JG: SG16 approved this.

JG: If you scroll back up, you'll see see it's very tiny. Two line change.

JG: I'm willing to submit an LWG issue to suggest we make a wording change to take it off our plate.

CC: Is this the one that changes left/right to beginning/end?

Some people: yes

MC: Any problem with Jeff's proposed direction and this proposed fix?

MC: I hear none.

[2019-11 Moved to Ready on Friday AM in Belfast]

Proposed resolution:

This wording is relative to N4835.

  1. Modify "Table 57 — Meaning of align options" [tab:format.align] as indicated:

    Table 57 — Meaning of align options [tab:format.align]
    Option Meaning
    < Forces the field to be left-aligned withinaligned to the start of the available space. This is the default for non-arithmetic types, charT, and bool, unless an integer presentation type is specified.
    > Forces the field to be right-aligned withinaligned to the end of the available space. This is the default for arithmetic types other than charT and bool or when an integer presentation type is specified.
    […]