Title
Add operator== to format_to_n_result
Status
new
Section
[format.syn]
Submitter
Mark de Wever

Created on 2021-11-14.00:00:00 last changed 1 week ago

Messages

Date: 2021-11-14.19:16:21

Proposed resolution:

This wording is relative to N4901.

  1. Modify [format.syn], header <format> synopsis, as indicated:

    […]
    template<class Out> struct format_to_n_result {
      Out out;
      iter_difference_t<Out> size;
      friend bool operator==(const format_to_n_result&, const format_to_n_result&) = default;
    };
    […]
    
Date: 2021-11-14.00:00:00

During the 2019 Cologne meeting the papers P1614R2 "The Mothership has Landed" and P0645R10 "Text Formatting" have been accepted. P1614R2 adds operator== to to_chars_result and from_chars_result. P0645R10 adds a similar type format_to_n_result without an operator==. LWG 3373 reaffirms these three types are similar by ensuring they can be used in structured bindings.

It seems due to accepting P1614R2 and P0645R10 during the same meeting the addition of operator== wasn't applied to format_to_n_result. I propose to add operator== to format_to_n_result to keep these types similar.

The Out template argument of format_to_n_result is unconstrained. Since it's returned from format_to_n it's indirectly constrained to an output_iterator. An output_iterator doesn't require equality_comparable, thus the defaulted operator== can be defined deleted.

History
Date User Action Args
2021-11-14 19:16:21adminsetmessages: + msg12225
2021-11-14 00:00:00admincreate