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.

3567. Formatting move-only iterators take two

Section: 28.5.6.7 [format.context] Status: C++23 Submitter: Casey Carter Opened: 2021-06-08 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [format.context].

View all issues with C++23 status.

Discussion:

LWG 3539(i) fixed copies of potentially-move-only iterators in the format_to and vformat_to overloads, but missed the fact that member functions of basic_format_context are specified to copy iterators as well. In particular, 28.5.6.7 [format.context] states:

iterator out();

-7- Returns: out_.

void advance_to(iterator it);

-8- Effects: Equivalent to: out_ = it;

both of which appear to require copyability.

[2021-06-23; Reflector poll]

Set status to Tentatively Ready after six votes in favour during reflector poll.

[2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4885.

  1. Modify 28.5.6.7 [format.context] as indicated:

    iterator out();
    

    -7- Returns: out_.Effects: Equivalent to: return std::move(out_);

    void advance_to(iterator it);
    

    -8- Effects: Equivalent to: out_ = std::move(it);