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

3473. Normative encouragement in non-normative note

Section: 22.14.8.3 [format.args] Status: C++23 Submitter: Jonathan Wakely Opened: 2020-07-31 Last modified: 2023-11-22

Priority: 0

View all other issues in [format.args].

View all issues with C++23 status.

Discussion:

The note in the final paragraph of 22.14.8.3 [format.args] gives encouragement to implementations, which is not allowed in a note.

It needs to be normative text, possibly using "should", or if left as a note could be phrased as "Implementations can optimize the representation […]".

[2020-08-09; Reflector prioritization]

Set priority to 0 and status to Tentatively Ready after six votes in favour during reflector discussions.

[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative to N4861.

  1. Modify 22.14.8.3 [format.args] as indicated:

    -1- An instance of basic_format_args provides access to formatting arguments. Implementations should optimize the representation of basic_format_args for a small number of formatting arguments. [Note: For example, by storing indices of type alternatives separately from values and packing the former. — end note]

    basic_format_args() noexcept;
    

    -2- Effects: Initializes size_ with 0.

    […]
    basic_format_arg<Context> get(size_t i) const noexcept;
    

    -4- Returns: i < size_ ? data_[i] : basic_format_arg<Context>().

    [Note: Implementations are encouraged to optimize the representation of basic_format_args for small number of formatting arguments by storing indices of type alternatives separately from values and packing the former. — end note]