- Title
- Can't make neither head nor tail of the description of operator<=>(tuple, tuple)
- Status
- new
- Section
- [tuple.rel]
- Submitter
- Corentin Jabot

Created on **2022-06-28.00:00:00**
last changed **1 month ago**

Date: 2022-07-08.20:04:38

**Proposed resolution:**

This wording is relative to N4910.

Modify [tuple.rel] as indicated:

template<class... TTypes, class... UTypes> constexpr common_comparison_category_t<

*synth-three-way-result*<TTypes, UTypes>...> operator<=>(const tuple<TTypes...>& t, const tuple<UTypes...>& u);-4-

:~~Effects~~Returnsfor the first*synth-three-way*(get<i>(t), get<i>(u))`i`for which the result of that expression does not compare equal to`0`. If no such`i`exists,`strong_ordering::equal`.~~Performs a lexicographical comparison between~~`t`and`u`. For any two zero-length tuples`t`and`u`,`t <=> u`returns`strong_ordering::equal`. Otherwise, equivalent to:~~if (auto c =~~*synth-three-way*(get<0>(t), get<0>(u)); c != 0) return c; return t_{tail}<=> u_{tail};~~where~~`r`for some tuple_{tail}`r`is a tuple containing all but the first element of`r`.-?-

*Remarks*: The elementaryexpressions are evaluated in order from the zeroth index upwards. No element accesses are performed after the first invocation that results in a value that does not compare equal to*synth-three-way*(get<i>(t), get<i>(u))`0`.~~-5- [~~*Note 1*: The above definition does not require`t`(or_{tail}`u`) to be constructed. It might not even be possible, as_{tail}`t`and`u`are not required to be copy constructible. Also, all comparison operator functions are short circuited; they do not perform element accesses beyond what is required to determine the result of the comparison. —*end note*]

Date: 2022-07-15.00:00:00

*[ 2022-07-08; Reflector poll ]*

Set priority to 4 after reflector poll.
Some votes for NAD and preference for the current wording, adding "in order"
to clarify the order of elements in `r`

.
_{tail}

Date: 2022-06-28.00:00:00

The specification of `operator<=>(tuple, tuple)` ([tuple.rel]) is described in
terms of imaginary tuples (`t _{tail}`,

The remark is copied from the similar wording of `operator==`

History | |||
---|---|---|---|

Date | User | Action | Args |

2022-07-08 20:04:38 | admin | set | messages: + msg12566 |

2022-07-03 12:20:01 | admin | set | messages: + msg12546 |

2022-06-28 00:00:00 | admin | create |