Title
Missing requirement for comparison_category
Status
c++23
Section
[string.view.comparison]
Submitter
Jonathan Wakely

Created on 2020-04-19.00:00:00 last changed 5 months ago

Messages

Date: 2020-11-09.20:31:48

Proposed resolution:

This wording is relative to N4861.

  1. Modify [string.view.comparison] by adding a new paragraph after p3:

    As result of reflector discussion we decided to make a drive-by fix in p3 below.

    template<class charT, class traits>
      constexpr see below operator<=>(basic_string_view<charT, traits> lhs,
                                      basic_string_view<charT, traits> rhs) noexcept;
    

    -3- Let R denote the type traits::comparison_category if that qualified-id is valid and denotes a type ([temp.deduct])it exists, otherwise R is weak_ordering.

    -?- Mandates: R denotes a comparison category type ([cmp.categories]).

    -4- Returns: static_cast<R>(lhs.compare(rhs) <=> 0).

Date: 2020-11-09.00:00:00

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

Date: 2020-07-15.00:00:00

[ 2020-07-17; Moved to Ready in telecon ]

Date: 2020-04-19.00:00:00

It's not clear what happens if a program-defined character traits type defines comparison_category as a synonym for void, or some other bogus type.

Discussion on the LWG reflector settled on making it ill-formed at the point of use.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2020-11-09 20:31:48adminsetmessages: + msg11547
2020-11-09 20:31:48adminsetstatus: ready -> wp
2020-07-17 22:37:26adminsetmessages: + msg11392
2020-07-17 22:37:26adminsetstatus: new -> ready
2020-04-20 13:25:37adminsetmessages: + msg11230
2020-04-19 00:00:00admincreate