Title
Clarify common comparison category conversions
Status
new
Section
[cmp.common]
Submitter
Peter Brett

Created on 2021-08-23.00:00:00 last changed 39 months ago

Messages

Date: 2021-09-20.11:39:03

Proposed resolution:

This wording is relative to N4892.

  1. Modify [cmp.common] as indicated:

    -1- The type common_comparison_category provides an alias for the strongest comparison category to which all of the template arguments can be converted among all the template arguments. [Note 1: A comparison category type is stronger than another if they are distinct types and an instance of the former can be converted to an instance of the latter. — end note]

    template<class... Ts>
    struct common_comparison_category {
      using type = see below;
    };
    

    -2- Remarks: The member typedef-name type denotes the common comparison type ([class.spaceship]) of Ts..., the expanded parameter pack, or void if any element of Ts is not a comparison category type.

Date: 2021-09-15.00:00:00

[ 2021-09-20; Reflector poll ]

Jens suggests alternative wording.

Previous resolution [SUPERSEDED]:

This wording is relative to N4892.

  1. Modify [cmp.common] as indicated:

    -1- The type common_comparison_category provides an alias for the strongest comparison category to which all of the template arguments can be converted. [Note 1: A comparison category type is stronger than another if they are distinct types and an instance of the former can be converted to an instance of the latter. — end note]

    template<class... Ts>
    struct common_comparison_category {
      using type = see below;
    };
    

    -2- Remarks: The member typedef-name type denotes the common comparison type ([class.spaceship]) of Ts..., the expanded parameter pack, or void if any element of Ts is not a comparison category type.

Date: 2021-09-15.00:00:00

[ 2021-09-20; Reflector poll ]

Set priority to 3 after reflector poll.

Date: 2021-08-23.00:00:00

[cmp.common]/1 says:

The type common_comparison_category provides an alias for the strongest comparison category to which all of the template arguments can be converted.

A naive reader like me might interpret this as meaning that (1) you attempt to convert the template arguments to comparison categories and then (2) obtain the strongest among them.

However, the intent is in fact to realize the common comparison type notion from [class.spaceship]/4. To obtain a non-void result, all the template arguments must be comparison categories, rather than convertible to comparison categories.

[cmp.common]/2 mildly contradicts the first paragraph:

Remarks: The member typedef-name type denotes the common comparison type ([class.spaceship]) of Ts..., the expanded parameter pack, or void if any element of Ts is not a comparison category type.

It more precisely states the behaviour, cross-references [class.spaceship], and uses the correct core terminology for the metafunction that the template represents.

Suggested resolution;

Delete [cmp.common]/1, because it does not provide any information not already more precisely included in [cmp.common]/2.

History
Date User Action Args
2021-09-20 11:39:03adminsetmessages: + msg12059
2021-09-20 11:22:03adminsetmessages: + msg12051
2021-08-27 18:52:31adminsetmessages: + msg12021
2021-08-23 00:00:00admincreate