From Jason Turner

[variant.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmptp5loh7h/{from.md → to.md} +8 -13
tmp/tmptp5loh7h/{from.md → to.md} RENAMED
@@ -1,28 +1,26 @@
1
  ### Header `<variant>` synopsis <a id="variant.syn">[[variant.syn]]</a>
2
 
3
  ``` cpp
 
 
4
  namespace std {
5
  // [variant.variant], class template variant
6
  template<class... Types>
7
  class variant;
8
 
9
  // [variant.helper], variant helper classes
10
  template<class T> struct variant_size; // not defined
11
  template<class T> struct variant_size<const T>;
12
- template <class T> struct variant_size<volatile T>;
13
- template <class T> struct variant_size<const volatile T>;
14
  template<class T>
15
  inline constexpr size_t variant_size_v = variant_size<T>::value;
16
 
17
  template<class... Types>
18
  struct variant_size<variant<Types...>>;
19
 
20
  template<size_t I, class T> struct variant_alternative; // not defined
21
  template<size_t I, class T> struct variant_alternative<I, const T>;
22
- template <size_t I, class T> struct variant_alternative<I, volatile T>;
23
- template <size_t I, class T> struct variant_alternative<I, const volatile T>;
24
  template<size_t I, class T>
25
  using variant_alternative_t = typename variant_alternative<I, T>::type;
26
 
27
  template<size_t I, class... Types>
28
  struct variant_alternative<I, variant<Types...>>;
@@ -76,25 +74,26 @@ namespace std {
76
  constexpr bool operator>(const variant<Types...>&, const variant<Types...>&);
77
  template<class... Types>
78
  constexpr bool operator<=(const variant<Types...>&, const variant<Types...>&);
79
  template<class... Types>
80
  constexpr bool operator>=(const variant<Types...>&, const variant<Types...>&);
 
 
 
81
 
82
  // [variant.visit], visitation
83
  template<class Visitor, class... Variants>
84
  constexpr see below visit(Visitor&&, Variants&&...);
 
 
85
 
86
  // [variant.monostate], class monostate
87
  struct monostate;
88
 
89
  // [variant.monostate.relops], monostate relational operators
90
- constexpr bool operator<(monostate, monostate) noexcept;
91
- constexpr bool operator>(monostate, monostate) noexcept;
92
- constexpr bool operator<=(monostate, monostate) noexcept;
93
- constexpr bool operator>=(monostate, monostate) noexcept;
94
  constexpr bool operator==(monostate, monostate) noexcept;
95
- constexpr bool operator!=(monostate, monostate) noexcept;
96
 
97
  // [variant.specalg], specialized algorithms
98
  template<class... Types>
99
  void swap(variant<Types...>&, variant<Types...>&) noexcept(see below);
100
 
@@ -103,12 +102,8 @@ namespace std {
103
 
104
  // [variant.hash], hash support
105
  template<class T> struct hash;
106
  template<class... Types> struct hash<variant<Types...>>;
107
  template<> struct hash<monostate>;
108
-
109
- // [variant.traits], allocator-related traits
110
- template <class T, class Alloc> struct uses_allocator;
111
- template <class... Types, class Alloc> struct uses_allocator<variant<Types...>, Alloc>;
112
  }
113
  ```
114
 
 
1
  ### Header `<variant>` synopsis <a id="variant.syn">[[variant.syn]]</a>
2
 
3
  ``` cpp
4
+ #include <compare> // see [compare.syn]
5
+
6
  namespace std {
7
  // [variant.variant], class template variant
8
  template<class... Types>
9
  class variant;
10
 
11
  // [variant.helper], variant helper classes
12
  template<class T> struct variant_size; // not defined
13
  template<class T> struct variant_size<const T>;
 
 
14
  template<class T>
15
  inline constexpr size_t variant_size_v = variant_size<T>::value;
16
 
17
  template<class... Types>
18
  struct variant_size<variant<Types...>>;
19
 
20
  template<size_t I, class T> struct variant_alternative; // not defined
21
  template<size_t I, class T> struct variant_alternative<I, const T>;
 
 
22
  template<size_t I, class T>
23
  using variant_alternative_t = typename variant_alternative<I, T>::type;
24
 
25
  template<size_t I, class... Types>
26
  struct variant_alternative<I, variant<Types...>>;
 
74
  constexpr bool operator>(const variant<Types...>&, const variant<Types...>&);
75
  template<class... Types>
76
  constexpr bool operator<=(const variant<Types...>&, const variant<Types...>&);
77
  template<class... Types>
78
  constexpr bool operator>=(const variant<Types...>&, const variant<Types...>&);
79
+ template<class... Types> requires (three_way_comparable<Types> && ...)
80
+ constexpr common_comparison_category_t<compare_three_way_result_t<Types>...>
81
+ operator<=>(const variant<Types...>&, const variant<Types...>&);
82
 
83
  // [variant.visit], visitation
84
  template<class Visitor, class... Variants>
85
  constexpr see below visit(Visitor&&, Variants&&...);
86
+ template<class R, class Visitor, class... Variants>
87
+ constexpr R visit(Visitor&&, Variants&&...);
88
 
89
  // [variant.monostate], class monostate
90
  struct monostate;
91
 
92
  // [variant.monostate.relops], monostate relational operators
 
 
 
 
93
  constexpr bool operator==(monostate, monostate) noexcept;
94
+ constexpr strong_ordering operator<=>(monostate, monostate) noexcept;
95
 
96
  // [variant.specalg], specialized algorithms
97
  template<class... Types>
98
  void swap(variant<Types...>&, variant<Types...>&) noexcept(see below);
99
 
 
102
 
103
  // [variant.hash], hash support
104
  template<class T> struct hash;
105
  template<class... Types> struct hash<variant<Types...>>;
106
  template<> struct hash<monostate>;
 
 
 
 
107
  }
108
  ```
109