From Jason Turner

[optional.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpq1s98nn8/{from.md → to.md} +18 -23
tmp/tmpq1s98nn8/{from.md → to.md} RENAMED
@@ -1,8 +1,10 @@
1
  ### Header `<optional>` synopsis <a id="optional.syn">[[optional.syn]]</a>
2
 
3
  ``` cpp
 
 
4
  namespace std {
5
  // [optional.optional], class template optional
6
  template<class T>
7
  class optional;
8
 
@@ -24,38 +26,35 @@ namespace std {
24
  constexpr bool operator>(const optional<T>&, const optional<U>&);
25
  template<class T, class U>
26
  constexpr bool operator<=(const optional<T>&, const optional<U>&);
27
  template<class T, class U>
28
  constexpr bool operator>=(const optional<T>&, const optional<U>&);
 
 
 
29
 
30
  // [optional.nullops], comparison with nullopt
31
  template<class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
32
- template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
33
- template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
34
- template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
35
- template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
36
- template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
37
- template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
38
- template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
39
- template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
40
- template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
41
- template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
42
- template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
43
 
44
- // [optional.comp_with_t], comparison with T
45
  template<class T, class U> constexpr bool operator==(const optional<T>&, const U&);
46
- template <class T, class U> constexpr bool operator==(const U&, const optional<T>&);
47
  template<class T, class U> constexpr bool operator!=(const optional<T>&, const U&);
48
- template <class T, class U> constexpr bool operator!=(const U&, const optional<T>&);
49
  template<class T, class U> constexpr bool operator<(const optional<T>&, const U&);
50
- template <class T, class U> constexpr bool operator<(const U&, const optional<T>&);
51
- template <class T, class U> constexpr bool operator<=(const optional<T>&, const U&);
52
- template <class T, class U> constexpr bool operator<=(const U&, const optional<T>&);
53
  template<class T, class U> constexpr bool operator>(const optional<T>&, const U&);
54
- template <class T, class U> constexpr bool operator>(const U&, const optional<T>&);
 
 
55
  template<class T, class U> constexpr bool operator>=(const optional<T>&, const U&);
56
- template <class T, class U> constexpr bool operator>=(const U&, const optional<T>&);
 
 
 
57
 
58
  // [optional.specalg], specialized algorithms
59
  template<class T>
60
  void swap(optional<T>&, optional<T>&) noexcept(see below);
61
 
@@ -70,9 +69,5 @@ namespace std {
70
  template<class T> struct hash;
71
  template<class T> struct hash<optional<T>>;
72
  }
73
  ```
74
 
75
- A program that necessitates the instantiation of template `optional` for
76
- a reference type, or for possibly cv-qualified types `in_place_t` or
77
- `nullopt_t` is ill-formed.
78
-
 
1
  ### Header `<optional>` synopsis <a id="optional.syn">[[optional.syn]]</a>
2
 
3
  ``` cpp
4
+ #include <compare> // see [compare.syn]
5
+
6
  namespace std {
7
  // [optional.optional], class template optional
8
  template<class T>
9
  class optional;
10
 
 
26
  constexpr bool operator>(const optional<T>&, const optional<U>&);
27
  template<class T, class U>
28
  constexpr bool operator<=(const optional<T>&, const optional<U>&);
29
  template<class T, class U>
30
  constexpr bool operator>=(const optional<T>&, const optional<U>&);
31
+ template<class T, three_way_comparable_with<T> U>
32
+ constexpr compare_three_way_result_t<T,U>
33
+ operator<=>(const optional<T>&, const optional<U>&);
34
 
35
  // [optional.nullops], comparison with nullopt
36
  template<class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
37
+ template<class T>
38
+ constexpr strong_ordering operator<=>(const optional<T>&, nullopt_t) noexcept;
 
 
 
 
 
 
 
 
 
39
 
40
+ // [optional.comp.with.t], comparison with T
41
  template<class T, class U> constexpr bool operator==(const optional<T>&, const U&);
42
+ template<class T, class U> constexpr bool operator==(const T&, const optional<U>&);
43
  template<class T, class U> constexpr bool operator!=(const optional<T>&, const U&);
44
+ template<class T, class U> constexpr bool operator!=(const T&, const optional<U>&);
45
  template<class T, class U> constexpr bool operator<(const optional<T>&, const U&);
46
+ template<class T, class U> constexpr bool operator<(const T&, const optional<U>&);
 
 
47
  template<class T, class U> constexpr bool operator>(const optional<T>&, const U&);
48
+ template<class T, class U> constexpr bool operator>(const T&, const optional<U>&);
49
+ template<class T, class U> constexpr bool operator<=(const optional<T>&, const U&);
50
+ template<class T, class U> constexpr bool operator<=(const T&, const optional<U>&);
51
  template<class T, class U> constexpr bool operator>=(const optional<T>&, const U&);
52
+ template<class T, class U> constexpr bool operator>=(const T&, const optional<U>&);
53
+ template<class T, three_way_comparable_with<T> U>
54
+ constexpr compare_three_way_result_t<T,U>
55
+ operator<=>(const optional<T>&, const U&);
56
 
57
  // [optional.specalg], specialized algorithms
58
  template<class T>
59
  void swap(optional<T>&, optional<T>&) noexcept(see below);
60
 
 
69
  template<class T> struct hash;
70
  template<class T> struct hash<optional<T>>;
71
  }
72
  ```
73