From Jason Turner

[comparisons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpef_m3hzp/{from.md → to.md} +78 -12
tmp/tmpef_m3hzp/{from.md → to.md} RENAMED
@@ -2,74 +2,140 @@
2
 
3
  The library provides basic function object classes for all of the
4
  comparison operators in the language ([[expr.rel]], [[expr.eq]]).
5
 
6
  ``` cpp
7
- template <class T> struct equal_to {
8
- bool operator()(const T& x, const T& y) const;
9
  typedef T first_argument_type;
10
  typedef T second_argument_type;
11
  typedef bool result_type;
12
  };
13
  ```
14
 
15
  `operator()` returns `x == y`.
16
 
17
  ``` cpp
18
- template <class T> struct not_equal_to {
19
- bool operator()(const T& x, const T& y) const;
20
  typedef T first_argument_type;
21
  typedef T second_argument_type;
22
  typedef bool result_type;
23
  };
24
  ```
25
 
26
  `operator()` returns `x != y`.
27
 
28
  ``` cpp
29
- template <class T> struct greater {
30
- bool operator()(const T& x, const T& y) const;
31
  typedef T first_argument_type;
32
  typedef T second_argument_type;
33
  typedef bool result_type;
34
  };
35
  ```
36
 
37
  `operator()` returns `x > y`.
38
 
39
  ``` cpp
40
- template <class T> struct less {
41
- bool operator()(const T& x, const T& y) const;
42
  typedef T first_argument_type;
43
  typedef T second_argument_type;
44
  typedef bool result_type;
45
  };
46
  ```
47
 
48
  `operator()` returns `x < y`.
49
 
50
  ``` cpp
51
- template <class T> struct greater_equal {
52
- bool operator()(const T& x, const T& y) const;
53
  typedef T first_argument_type;
54
  typedef T second_argument_type;
55
  typedef bool result_type;
56
  };
57
  ```
58
 
59
  `operator()` returns `x >= y`.
60
 
61
  ``` cpp
62
- template <class T> struct less_equal {
63
- bool operator()(const T& x, const T& y) const;
64
  typedef T first_argument_type;
65
  typedef T second_argument_type;
66
  typedef bool result_type;
67
  };
68
  ```
69
 
70
  `operator()` returns `x <= y`.
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  For templates `greater`, `less`, `greater_equal`, and `less_equal`, the
73
  specializations for any pointer type yield a total order, even if the
74
  built-in operators `<`, `>`, `<=`, `>=` do not.
75
 
 
2
 
3
  The library provides basic function object classes for all of the
4
  comparison operators in the language ([[expr.rel]], [[expr.eq]]).
5
 
6
  ``` cpp
7
+ template <class T = void> struct equal_to {
8
+ constexpr bool operator()(const T& x, const T& y) const;
9
  typedef T first_argument_type;
10
  typedef T second_argument_type;
11
  typedef bool result_type;
12
  };
13
  ```
14
 
15
  `operator()` returns `x == y`.
16
 
17
  ``` cpp
18
+ template <class T = void> struct not_equal_to {
19
+ constexpr bool operator()(const T& x, const T& y) const;
20
  typedef T first_argument_type;
21
  typedef T second_argument_type;
22
  typedef bool result_type;
23
  };
24
  ```
25
 
26
  `operator()` returns `x != y`.
27
 
28
  ``` cpp
29
+ template <class T = void> struct greater {
30
+ constexpr bool operator()(const T& x, const T& y) const;
31
  typedef T first_argument_type;
32
  typedef T second_argument_type;
33
  typedef bool result_type;
34
  };
35
  ```
36
 
37
  `operator()` returns `x > y`.
38
 
39
  ``` cpp
40
+ template <class T = void> struct less {
41
+ constexpr bool operator()(const T& x, const T& y) const;
42
  typedef T first_argument_type;
43
  typedef T second_argument_type;
44
  typedef bool result_type;
45
  };
46
  ```
47
 
48
  `operator()` returns `x < y`.
49
 
50
  ``` cpp
51
+ template <class T = void> struct greater_equal {
52
+ constexpr bool operator()(const T& x, const T& y) const;
53
  typedef T first_argument_type;
54
  typedef T second_argument_type;
55
  typedef bool result_type;
56
  };
57
  ```
58
 
59
  `operator()` returns `x >= y`.
60
 
61
  ``` cpp
62
+ template <class T = void> struct less_equal {
63
+ constexpr bool operator()(const T& x, const T& y) const;
64
  typedef T first_argument_type;
65
  typedef T second_argument_type;
66
  typedef bool result_type;
67
  };
68
  ```
69
 
70
  `operator()` returns `x <= y`.
71
 
72
+ ``` cpp
73
+ template <> struct equal_to<void> {
74
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
75
+ -> decltype(std::forward<T>(t) == std::forward<U>(u));
76
+
77
+ typedef unspecified is_transparent;
78
+ };
79
+ ```
80
+
81
+ `operator()` returns `std::forward<T>(t) == std::forward<U>(u)`.
82
+
83
+ ``` cpp
84
+ template <> struct not_equal_to<void> {
85
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
86
+ -> decltype(std::forward<T>(t) != std::forward<U>(u));
87
+
88
+ typedef unspecified is_transparent;
89
+ };
90
+ ```
91
+
92
+ `operator()` returns `std::forward<T>(t) != std::forward<U>(u)`.
93
+
94
+ ``` cpp
95
+ template <> struct greater<void> {
96
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
97
+ -> decltype(std::forward<T>(t) > std::forward<U>(u));
98
+
99
+ typedef unspecified is_transparent;
100
+ };
101
+ ```
102
+
103
+ `operator()` returns `std::forward<T>(t) > std::forward<U>(u)`.
104
+
105
+ ``` cpp
106
+ template <> struct less<void> {
107
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
108
+ -> decltype(std::forward<T>(t) < std::forward<U>(u));
109
+
110
+ typedef unspecified is_transparent;
111
+ };
112
+ ```
113
+
114
+ `operator()` returns `std::forward<T>(t) < std::forward<U>(u)`.
115
+
116
+ ``` cpp
117
+ template <> struct greater_equal<void> {
118
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
119
+ -> decltype(std::forward<T>(t) >= std::forward<U>(u));
120
+
121
+ typedef unspecified is_transparent;
122
+ };
123
+ ```
124
+
125
+ `operator()` returns `std::forward<T>(t) >= std::forward<U>(u)`.
126
+
127
+ ``` cpp
128
+ template <> struct less_equal<void> {
129
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
130
+ -> decltype(std::forward<T>(t) <= std::forward<U>(u));
131
+
132
+ typedef unspecified is_transparent;
133
+ };
134
+ ```
135
+
136
+ `operator()` returns `std::forward<T>(t) <= std::forward<U>(u)`.
137
+
138
  For templates `greater`, `less`, `greater_equal`, and `less_equal`, the
139
  specializations for any pointer type yield a total order, even if the
140
  built-in operators `<`, `>`, `<=`, `>=` do not.
141