Title
Include <compare> from most library headers
Status
c++20
Section
[coroutine.syn][system.error.syn][utility.syn] [tuple.syn][optional.syn][variant.syn] [memory.syn][type.index.synopsis][string.syn] [string.view.synop][array.syn][deque.syn] [forward.list.syn][list.syn][vector.syn] [associative.map.syn][associative.set.syn][unord.map.syn] [unord.set.syn][queue.syn][stack.syn] [iterator.synopsis][ranges.syn][time.syn] [fs.filesystem.syn][re.syn][thread.syn]
Submitter
United States

Created on 2019-11-07.00:00:00 last changed 45 months ago

Messages

Date: 2019-11-08.12:06:23

Proposed resolution:

This wording is relative to N4835.

  1. Add

    #include <compare>
    

    to the following header synopses:

    1. [coroutine.syn]
    2. [system.error.syn]
    3. [utility.syn]
    4. [tuple.syn]
    5. [optional.syn]
    6. [variant.syn]
    7. [memory.syn]
    8. [type.index.synopsis]
    9. [string.syn]
    10. [string.view.synop]
    11. [array.syn]
    12. [deque.syn]
    13. [forward.list.syn]
    14. [list.syn]
    15. [vector.syn]
    16. [associative.map.syn]
    17. [associative.set.syn]
    18. [unord.map.syn]
    19. [unord.set.syn]
    20. [queue.syn]
    21. [stack.syn]
    22. [iterator.synopsis]
    23. [ranges.syn]
    24. [time.syn]
    25. [fs.filesystem.syn]
    26. [re.syn]
    27. [thread.syn]
Date: 2019-11-08.12:06:23

[ 2019-11 Moved to Ready on Friday AM in Belfast ]

Date: 2019-11-07.00:00:00

Addresses US 181

The spaceship operator<=> is typically not usable unless the library header <compare> is directly included by the user. Many standard library headers provide overloads for this operator. Worse, several standard classes have replaced their existing definition for comparison operators with a reliance on the spaceship operator, and existing code will break if the necessary header is not (transitively) included. In a manner similar to the mandated library headers transitively #include-ing <initializer_list> in C++11, these headers should mandate a transitive #include <compare>.

Proposed change:

Add:

#include <compare>

to the header synopsis for each of the following headers:

<array>
<chrono>
<coroutine>
<deque>
<forward_list>
<filesystem>
<iterator>
<list>
<map>
<memory>
<optional>
<queue>
<ranges>
<regex>
<set>
<stack>
<string>
<string_view>
<system_error>
<thread>
<tuple>
<type_index>
<unordered_map>
<unordered_set>
<utility>
<variant>
<vector>
History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: voting -> wp
2020-01-17 04:54:50adminsetstatus: ready -> voting
2019-11-08 12:06:23adminsetmessages: + msg10806
2019-11-08 12:06:23adminsetstatus: new -> ready
2019-11-07 20:51:54adminsetmessages: + msg10801
2019-11-07 00:00:00admincreate